NSPopUpButtonCell prevents selection update of NSArrayController
NSPopUpButtonCell prevents selection update of NSArrayController
- Subject: NSPopUpButtonCell prevents selection update of NSArrayController
- From: Orestis Markou <email@hidden>
- Date: Fri, 16 Nov 2007 00:33:53 +0200
I have an NSArrayController that has in the last column an
NSPopUpButtonCell, for a master-detail scenario.
I have used bindings to set it all up and it works.
However, I want to hide some of the MenuItems of the PopUpMenu
depending on the row I am in. For example, according to the type of
the object bound to the row, there are different choices in the pop-up
menu. I can do this using the menu:updateItem:atIndex:shouldCancel:
method.
Here is the bug: the selection of the NSArrayController isn't updated
until *after* the pop-up menu has *closed*. So of course when accesing
selection from within menu:updateItem:atIndex:shouldCancel:, I get the
wrong data. If I carefully select the row before summoning the menu,
everything works fine.
So, I have three paths:
a) try to somehow intercept the mouse click and deliver it first to
the NSArrayController, then the pop-up cell
b) delay the opening/creation of the pop-up menu until the selection
is updated
c) bypass the controller and its bindings altogether and do the menu
column manually.
I can't find a straightforward way to do any of the above, so please
help!
I am very new to Cocoa, so I may have missed something fundamental.
Please say so.
Thank you,
--
Orestis Markou
email@hidden
http://orestis.gr/
_______________________________________________
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