Re: NSTableView issues?
Re: NSTableView issues?
- Subject: Re: NSTableView issues?
- From: Ryan Stevens <email@hidden>
- Date: Sun, 25 Aug 2002 08:33:30 -0700
What about doing it like this instead?...
{
id dataToReturn = nil;
NSString *identifier = ...
if ([identifier isEqualtoString: ]) dataToReturn = ...;
NSLog(@"data is: %@", dataToReturn);
return dataToReturn;
}
On Saturday, August 24, 2002, at 10:30 PM, Neal Parikh wrote:
Correct. I'm not using an autorelease pool. I can send you an archive
of the code+nib, in case I'm missing something obvious, but ... I just
can't see what it could be.
- Neal
On Sunday, August 25, 2002, at 01:21 AM, Kevin Callahan wrote:
so let me get this straight ..
your array has the correct value as is evidenced by the NSLog output..
so the value is there, it's live and it's not autoreleased or anything.
right?
Kevin
On Saturday, August 24, 2002, at 10:13 PM, Neal Parikh wrote:
I tried hardcoding it as you suggested but that made no difference.
I also checked the identifiers again, and they're correct as far as I
can see ... I retyped them just to make sure there wasn't any really
funky business. The first column is "userName" and the second is
"userLogin".
I can upload the nib itself if you'd like, but the name of the
identifier is not a problem as far as I can see.
Any other ideas? This is really killing me. :)
Thanks so far.
- Neal
On Sunday, August 25, 2002, at 12:48 AM, Kevin Callahan wrote:
try this , hardcode a string for the login selection and see if it
prints to the table ..
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex
{
NSString *identifier = [aTableColumn identifier];
if ([identifier isEqualToString:@"userLogin"]) {
NSLog(@"userLoginArray = %@", [userLoginArray
objectAtIndex:rowIndex]);
return @"aLoginName";
}
else if ([identifier isEqualToString:@"userName"]) {
NSLog(@"userNameArray = %@", [userNameArray
objectAtIndex:rowIndex]);
return [userNameArray objectAtIndex:rowIndex];
}
}
let me know what happens..
if that doesn't work, then there's likely a problem with the
identifier in your table as set in IB .. look for a space in the
identifier .. for example
Kevin
On Saturday, August 24, 2002, at 09:33 PM, Neal Parikh wrote:
I am using IB to set the identifiers, and they are what they say
they are. And that part is working, because the conditionals where
I'm checking for the value of identifier are going through properly
because it does execute the NSLog()s inside.
So I'm rather confused. :-)
- Neal
On Saturday, August 24, 2002, at 11:33 PM, Carlos Weber wrote:
On Saturday, Aug 24, 2002, at 12:32 Pacific/Honolulu, Neal Parikh
wrote:
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.
When I've had this kind of inexplicable bug it has usually been a
problem with my nib. If you are setting the table column
identifiers in IB via the Info Panel, doublecheck to make sure
they are set the way you think they are. If you are not using IB
to set the identifiers, how are you doing it?
--
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.
- Kevin
o#?
--
Neal Parikh <email@hidden>
"Few mortals realize how many other advantages follow from being free
from scruples and ready to venture anything." (Erasmus)
- Kevin
o#?
--
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.
_______________________________________________
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.