Re: Custom canRemove binding
Re: Custom canRemove binding
- Subject: Re: Custom canRemove binding
- From: Raphael Sebbe <email@hidden>
- Date: Wed, 5 May 2004 15:53:46 +0200
You have to tell when myCanDelete changes.
in insert and remove KVC accessors, as well as other methods changing
the array count, add this:
[self willChangeValueForKey:@"myCanDelete"];
change array, and thus count
[self didChangeValueForKey:@"myCanDelete"];
HTH,
Raphael
On 05 May 2004, at 14: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-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
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.