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 13:07:51 +0100
The 'anIndex' in my snippet is just nothing - you'd have to determine
that. I guess it would be something like the selected object index of
the array controller you're binding the popup's content to?
As for whether or not it's possible to do this with bindings, I'm not
100% sure...
When the table is first displayed, are the proper selections displayed
for each row? Does this problem only come up when you change the
selection selection in one of the pop up cells?
On Nov 4, 2008, at 11:49 AM, Ken Tozier wrote:
Hmmm. So there's no way to set this up just through bindings?
Also, in your snippet, where does "anIndex" come from?
On Nov 4, 2008, at 5:32 AM, Cathy Shive wrote:
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
_______________________________________________
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