NSToolbarItem enable binding
NSToolbarItem enable binding
- Subject: NSToolbarItem enable binding
- From: Camille GOUREAU-SUIGNARD <email@hidden>
- Date: Sat, 6 Jan 2007 09:21:27 +0100
Hi,
my problem is: the automatic validation of a toolbarItem via binding.
Entity B has a relationship whose destination is entity A with a
delete rule 'Deny'.
Entity A populates an arrayController (C).
A tableView (D) has its rows binded to C.
A toolbarItem (E) has its action set to 'remove:' method from C
(NSArrayController).
A deletable row/managed object (A) is one that is not the destination
of any instance of B.
So I want E (NSToolbarItem) to be enbled/validated only if the
selected instance of entity A is deletable (validateForDelete:).
I subclassed NSManagedObject to define entity A and created the method:
- (BOOL) deletable ;
{
NSError *erreur = nil ;
return [self validateForDelete: &erreur] ;
}
I binded E (NSToolbarItem) 'enabled' to C with controller key
'selection' and model key path 'deletable'.
And my toolbarItem behaves very strangely: it isn't enabled for a few
microseconds (when deletable is called) then immediatly re-enabled.
And I don't understand why.
1. could you explain me why it is re-enabled ?
2. is there a more elegant way to achieve my goal ?
Thanks a lot.
Camille Goureau
Et mon blog: www.lutin-ludique.com/bradype/
_______________________________________________
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