NSBroswer_NSTableView
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