Conditionally enable a button based on NSArrayController's selectedObjects?
Conditionally enable a button based on NSArrayController's selectedObjects?
- Subject: Conditionally enable a button based on NSArrayController's selectedObjects?
- From: John Fox <email@hidden>
- Date: Fri, 28 Apr 2006 12:31:03 -0700
Hello:
I'm trying to enable/disable an action button based on whether or not
selectedObjects has at least one object. I thought this should be
simple, but maybe I'm just dull and stupid. In IB, I connected the
"enabled" to a method I created in my controller which looks like this:
(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)
- (BOOL)hasSelectedObjects
// Used to enable/disable an action button
{
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?
I apologize if this is obvious. I really did RTFM and try Google.
Best,
John
_______________________________________________
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