• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSBroswer_NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSBroswer_NSTableView


  • Subject: NSBroswer_NSTableView
  • From: francois fauteux <email@hidden>
  • Date: Tue, 8 Nov 2005 17:23:11 -0500

Hi list !

I am trying to get a browser single click (assuming browser selected
pathToFile is a tab-delimited file) to display the file content into a
tableView (instead of a textView) - something like what excel would do
when opening a tab-d text file.

I tried the following, but the browserSingleClick action doesn't get
the text file to display in the tableView. I know I should send a
message to tableView under the browser single click, but what, I have
no clue ?

Do you have any idea on how to get that working and what message to
send to tableView?

- (IBAction)browserSingleClick:(id)browser {
NSString *pathToFile = [browser path];
NSString *fileContents = [NSString stringWithContentsOfFile: pathToFile];
int i;
NSArray *tempArray = [fileContents componentsSeparatedByString:@"\r"];
dataArray = [[NSMutableArray alloc] init];
for(i=0; i<[tempArray count]; i++)
{
NSString *tempString = [tempArray objectAtIndex:i];
[dataArray addObject:[tempString componentsSeparatedByString:@"\t"]];
}
}

- (int)numberOfRowsInTableView:(NSTableView *)aTableView{
return [dataArray count];
}

- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
int columnID;
columnID = [[aTableColumn identifier] intValue];
return [[dataArray objectAtIndex:rowIndex] objectAtIndex:columnID];
}

Thanks a lot for your time and recomandations. Very best regards.

François Fauteux
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSBroswer_NSTableView
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: Understanding [NSTextview setInsertionPointColor:]
  • Next by Date: Re: Questiong on NSString sizeWithAttributes
  • Previous by thread: Re: Using NSController inside an Interface Builder inspector?
  • Next by thread: Re: NSBroswer_NSTableView
  • Index(es):
    • Date
    • Thread