Re: 2 Beginner Bindings Questions
Re: 2 Beginner Bindings Questions
- Subject: Re: 2 Beginner Bindings Questions
- From: Peter Zegelin <email@hidden>
- Date: Wed, 3 Nov 2010 21:39:52 +1100
On 03/11/2010, at 8:02 PM, Peter Zegelin wrote:
>>>
>>> My other question is related. I would like to enable the delete button only if there is a selection in the table. Again, I have tried binding the enabled property of the button to the controller with various combinations of Controller Key and Model Key Path, with no luck.
>>
>> Bind the enable state of the button to the "canRemove" property of the array controller. Note that it's actually inherited from the superclass, NSObjectController, which is probably why you didn't find it.
>>
>>
>
> Tried that and it didn't work. The button never disables/enables with the selection and pressing it removes the first object in the array even if not selected. When the last object is removed *then* the button disables.
I discovered the following works:
Bind the button enabled binding to the ArrayController.
Controller Key = selection
Model Key Path is left blank
Value Transformer = NSIsNotNil
cheers,
Peter_______________________________________________
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