Re: Custom canRemove binding
Re: Custom canRemove binding
- Subject: Re: Custom canRemove binding
- From: ian <email@hidden>
- Date: Wed, 5 May 2004 15:09:42 +0100
Thanks to Chris Giordano and Raphael Sebbe who both noticed I'd missed
the page of the docs that say the observers need to be notified of
changes to the model :)
[self willChangeValueForKey:@"myCanDelete"];
//change the value
[self didChangeValueForKey:@"myCanDelete"];
Thanks loads for that guys.
Ian
On 5 May 2004, at 13:26, ian wrote:
Hello,
I'm using an NSArrayController to populate a tableview according to
the contents of an array of objects in an instance of MyDocument for a
doc based app.
I've got add/insert/remove buttons set up and the add/insert are
enabled by binding to the array controller's selection - canAdd and
canInsert.
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.
Any ideas before I go ahead and subclass NSArrayController to override
canRemove?
Cheers
Ian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-d
_______________________________________________
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.