NSTableView issues?
NSTableView issues?
- Subject: NSTableView issues?
- From: Neal Parikh <email@hidden>
- Date: Sat, 24 Aug 2002 18:32:58 -0400
Hi,
I'm writing Cocoa for the first time, and I'm running into some trouble
with my NSTableView. This is how I've set stuff up:
- there's a "Refresh" button which is connected to an AppController
- the AppController's outlet is the NSTableView
- the NSTableView (named mainTable in my code) has two columns, and
i've set identifiers for both
- I'm filling two arrays with various data (which works correctly; I
checked with NSLog()), and I want mainTable to use one for column #1,
the other for column #2
So what I've done in the '(id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex' method (which I've implemented in my AppController
class) is the following:
/* *** */
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn row:(int)rowIndex
{
NSString *identifier = [aTableColumn identifier];
if ([identifier isEqualToString:@"userLogin"]) {
NSLog(@"userLoginArray = %@", [userLoginArray
objectAtIndex:rowIndex]);
return [userLoginArray objectAtIndex:rowIndex];
}
else if ([identifier isEqualToString:@"userName"]) {
NSLog(@"userNameArray = %@", [userNameArray objectAtIndex:rowIndex]);
return [userNameArray objectAtIndex:rowIndex];
}
}
/* *** */
Now, the first column (userName) gets filled properly and works fine,
and I can see when I scroll up and down that those two NSLog()
statements are both getting executed in alternating order, which seems
correct. But the second column (identifier "userLogin") simply will
not display my data (stored in 'userLoginArray'). My current idea is
that my mistake is somewhere in the above method, but I'm not sure.
I've spent a fair bit of time going through the NSTableView
documentation, but that hasn't really helped with this bug.
Any ideas, tips, links, clues, etc would be greatly appreciated. =)
Thanks in advance.
- Neal
--
Neal Parikh <email@hidden>
"Few mortals realize how many other advantages follow from being free
from scruples and ready to venture anything." (Erasmus)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.