• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom Enable Binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Custom Enable Binding
      • From: Keary Suska <email@hidden>
  • Prev by Date: [Long] Modular design and issues
  • Next by Date: so many resource occupied by QCRenderer.
  • Previous by thread: Re: [Long] Modular design and issues
  • Next by thread: Re: Custom Enable Binding
  • Index(es):
    • Date
    • Thread