Custom Enable Binding
Custom Enable Binding
- Subject: Custom Enable Binding
- From: Sanjay Samani <email@hidden>
- Date: Tue, 13 Mar 2007 11:54:44 +0000 (GMT)
I am trying to use a custom method for a button's enabled binding but it is
only getting called once, at initialisation and not subsequently.
I have a table that is bound to a NSArrayController subclass,
DTElementArrayController. The Element Array Controller has the following code:
+(void)initialize;
{
if (self == [DTElementArrayController class])
{
[self setKeys:[NSArray arrayWithObject:@"selectionIndexes"]
triggerChangeNotificationsForDependentKey:@"canMapSelectedElements"];
}
}
- (BOOL)canMapSelectedElements;
{
// custom logic for whether this is possible
}
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'm sure I'm missing something obvious. I've tried hunting around the docs,
mmalc's binding examples, etc., but I can't seem to find a custom
enabled/hidden binding example.
Thanks,
Sanjay
___________________________________________________________
Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
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