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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to