Re: Please help. At wit's end binding NSPopupButtonCell selection
Re: Please help. At wit's end binding NSPopupButtonCell selection
- Subject: Re: Please help. At wit's end binding NSPopupButtonCell selection
- From: Cathy Shive <email@hidden>
- Date: Tue, 4 Nov 2008 11:32:50 +0100
On Nov 4, 2008, at 10:05 AM, Ken Tozier wrote:
What happens is that when I choose an item in one row's popup cell,
the selection in every popup in the entire table changes to the new
selection.
Don't forget that there is only one NSPopUpButtonCell per column. If
you change it's selection, it's actually correct that when the table
redraws, the other rows will redraw to show the new selection.
Basically - If you have 5 rows, it appears that there are 5 different
popup menus, but really, there is one that has been drawn 5 times at
different locations.
The table view tells you when it's about to draw a cell and you can
set the correct selection of your popup cell here. All you need to do
is implement the delegate method:
- (BOOL)tableView:(NSTableView *)theTableView willDisplayCell:
(id)theCell forTableColumn:(NSTableColumn*)theTableColumn row:
(int)theRowIndex
{
if([[theTableColumn identifier]
isEqualToString:@"MyPopUpButtonColumn"])
[theCell selectItemAtIndex:anIndex];
}
HTH,
Cathy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden