Re: Conditionally enable a button based on NSArrayController's selectedObjects?
Re: Conditionally enable a button based on NSArrayController's selectedObjects?
- Subject: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
- From: Ondra Cada <email@hidden>
- Date: Fri, 28 Apr 2006 21:44:15 +0200
John,
On 28.4.2006, at 21:31, John Fox wrote:
(Is there a way to bind to the count of selecteObjects without
having to write a method in my controller? I tried
selectedObjects.count, but that didn't work)
selectedObjects.@count should work (read the KVC manual for more of
these tricks).
- (BOOL)hasSelectedObjects {
return ([self selectedObjects] && [[self selectedObjects] count]);
}
The problem is that as selectedObjects changes in my array
controller, the above method is not called. Bummer. I could
override setSelectedObjects: I'm sure, but then why use bindings at
all?
It *should* be solvable by a simple +initialize with
setKeys:triggerChangeNotificationsForDependentKey: (read on KVO :))
For some reason which I don't get (halo? MMalc? Can you perhaps
elucidate? Or another guru?) though it does not. See
http://www.cocoabuilder.com/archive/message/cocoa/2006/3/13/158573
for details and (ugly, but useable) work-around.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden