Re: Custom canRemove binding
Re: Custom canRemove binding
- Subject: Re: Custom canRemove binding
- From: Allan Odgaard <email@hidden>
- Date: Wed, 5 May 2004 16:22:12 +0200
On 5. May 2004, at 14:26, ian wrote:
I'd like to prevent the user from deleting the last row in the table
however, so I bound the remove button to File's Owner (MyDocument) and
a model key path of "myCanDelete" which is the name of a method that
returns ([theArray count]>1)
Trouble is, this is called once only at startup, so the button doesn't
update.
And here's the third suggestion! :)
Given that 'contentArray' of your array controller is bound to [File's
Owner].myArray then add this to MyDocument.m (see NSKeyValueObserving
protocol description for details):
+ (void)initialize
{
[self setKeys:[NSArray arrayWithObject:@"myArray"]
triggerChangeNotificationsForDependentKey:@"myCanDelete"];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.