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: Mike Abdullah <email@hidden>
- Date: Fri, 28 Apr 2006 22:43:02 +0100
Or there is the better option of binding enabled of the button to
canRemove of the array controller.
Mike.
On 28 Apr 2006, at 21:01PM0, Ondra Cada wrote:
Oh, by the way:
On 28.4.2006, at 21:31, John Fox wrote:
return ([self selectedObjects] && [[self selectedObjects]
count]);
there's no point. Just
return [[self selectedObjects] count]; // practical and pragmatic
or perhaps
return [[self selectedObjects] count]>0; // equal, a bit more
intention-revealing
which is more readable and works exactly as well.
OTOH, if you want to be paranoid on whether int and id are actually
represented the same way (they are bound to be in practice, though
it is not exactly a hard-rock API contract), you would have to be
paranoid about BOOL too:
return [self selectedObjects]!=nil && [[self selectedObjects] count]
>0; // paranoically superclean
---
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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