Re: Custom Enable Binding
Re: Custom Enable Binding
- Subject: Re: Custom Enable Binding
- From: Keary Suska <email@hidden>
- Date: Tue, 13 Mar 2007 09:50:18 -0700
- Thread-topic: Custom Enable Binding
on 3/13/07 4:54 AM, email@hidden purportedly said:
> The button's enabled binding is bound to DTElementArrayController with
> Controller Key canMapSelectedElements.
>
> The table columns are bound to the DTElementArrayController's arrangedObjects
> (all works fine) and the Table's SelectionIndexes binding is bound to the
> array controller's selectionIndexes.
>
> My +initialize get called and the -canMapSelectedElements gets called once on
> application start up.
>
> When I change the selection of the table, -canMapSelectedElements is not
> called and my button remains disabled.
I have never had success adding controller keys to object controller
subclasses. The controller API's are pretty opaque, so it's hard to know
whether you are tromping on the controller's operation.
In any case, the canMapSelectedElements logic should probably go into your
model class, if you have one. I doubt you will be able to get what you want
from the controller subclass.
An alternative could be to make the custom controller the delegate of the
table view (you may also need an outlet) and implement
-tableViewSelectionDidChange. If your method needs to know what is selected,
you may need to call -selectedRowIndexes on the tableview if the controller
doesn't seem to know its selection yet. I have found that some actions are
performed with a delay so aren't available immediately in code. Which do
this, and under what circumstances, is not documented AFAIK.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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