Re: How To Bind The Enabled Property of NSPopUpButtonCell Menu Items
Re: How To Bind The Enabled Property of NSPopUpButtonCell Menu Items
- Subject: Re: How To Bind The Enabled Property of NSPopUpButtonCell Menu Items
- From: Lee Ann Rucker <email@hidden>
- Date: Fri, 02 Aug 2013 14:27:51 -0700
NSMenuItem. I noticed that the NSPopUpButtonCell also has an autoenables items flag; a quick bit of hacking on the ButtonMadness sample app shows that needs to be off too. I'll send you the files off-list.
On Aug 2, 2013, at 1:56 PM, Chris Tracewell wrote:
> Thanks for the suggestion, I had already done that to no avail. Where should I be binding the enabled property? NSPopUpButtonCell or NSMenuItem?
>
>
> CT
>
>
>
> On Aug 2, 2013, at 1:33 PM, Lee Ann Rucker <email@hidden> wrote:
>
>> Turn off "Auto Enables Items" in the popup's menu. If it's on it goes through menu validation instead of bindings.
>>
>> On Aug 2, 2013, at 1:12 PM, Chris Tracewell wrote:
>>
>>> I've got a two column NSTableView that is bound to an array controller. Each of the elements in the array looks something like this...
>>>
>>> NSMutableDictionary *theDictionary = [NSMutableDictionary dictionaryWithDictionary: @{@"myOptions":theOptionArray,@"myTitle": theTitle}];
>>>
>>> Column 1 is bound to myTitle and column 2, whcih had an NSPopUpButtonCell in it, is bound to myOptions. This all works up to this point, the menus populate for each row in the table view and I can make selections and update things in my controller. What I need to do is bind the individual enabled state of each menu item in the myOptions array. Binding the enabled state for the column does not work as it disables the entire menu. I've tried binding to both NSPopUpButtonCell and its NSMenuItem but nothing happens (all menu items remain enabled). Just to test I tried binding these two to arrangedObjects @count of the array controller (using NSNegateBoolean) but still nothing.
>>>
>>> The other two methods I have tried is a custom NSValueTransformer for the NSMenuItem and the validateMenuItem method. The transformer got called but I logged the value it was passing in and it's the array myOptions not the individual menu items. The validateMenuItem method worked for other UI NSPopUpMenus but not the ones in my tableview.
>>>
>>> Is this possible to do with bindings? Thanks for the help.
>>>
>>>
>>> CT
>>> _______________________________________________
>>>
>>> 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