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: Chris Tracewell <email@hidden>
- Date: Fri, 02 Aug 2013 16:21:16 -0700
I took a look, thanks for the files. I had both deselected already, still makes no difference. I created a new project and rolled a stripped down version and it acted the same way. I can't see how bindings and validateMenuItem can work together in this scenario. I'm going to try catching change selections and validate there as the revalidation only needs to happen after a change. I've posted my simple project displaying the project if you're interested.
http://tinyurl.com/k3y7432
CT
On Aug 2, 2013, at 2:27 PM, Lee Ann Rucker <email@hidden> wrote:
> 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