Reputation: 2380
It’s been a very long time since I’ve working with Cocoa Bindings, so my knowledge isn’t very fresh.
I am trying to connect up a NSPopUpButton
so that each menu item can be enabled or disabled separately. I have connected up the content
binding to an array controller that has two properties: localizedName
and enabled
. These represent the names and enabled status of each menu item that will be shown.
I’ve also connected up the contentValues
binding so that it is bound to the arrangedObjects.localizedName
property.
Now I’m stumped. There is an enabled
binding but it seems to connect to the entire popup button, not the menu items.
Is there a way to connect to the enabled property of each individual menu item? in the same way as is possible with NSTableView
?
Thanks in advance.
Frank
Upvotes: 0
Views: 42
Reputation: 2380
Just for posterity: While I haven't found out how to link to the enabled attribute of the popup menu button's NSMenuItem
, I have found out that NSPopupButton
does not handle disabled menu items anyway.. it just does nothing. The state
and the hidden
attributesboth work fine, however, so I ended up just hiding the non-selectable entries via the
NSMenuDelegate` instead.
Upvotes: 0