• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Conditionally enable a button based on NSArrayController's selectedObjects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Conditionally enable a button based on NSArrayController's selectedObjects?
      • From: Ondra Cada <email@hidden>
References: 
 >Conditionally enable a button based on NSArrayController's selectedObjects? (From: John Fox <email@hidden>)
 >Re: Conditionally enable a button based on NSArrayController's selectedObjects? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Do I need private accessor methods?
  • Next by Date: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • Previous by thread: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • Next by thread: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • Index(es):
    • Date
    • Thread