• 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: How to get a NSButton (check box) state
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a NSButton (check box) state


  • Subject: Re: How to get a NSButton (check box) state
  • From: Greg Guerin <email@hidden>
  • Date: Mon, 8 Jun 2009 15:14:51 -0700

Martin Batholdy wrote:

Now I want to test the state via;

if([launchOption state] == 0) {	NSLog(@"A");	}
else if([launchOption state] == 1) {	NSLog(@"B");	}

The answer of this if / else statement is always A and I don't understand why.

In addition to what was said about using NSOnState and NSOffState, you should confirm that launchOption actually contains a non-nil object.


Think about what will happen in your code if launchOption is nil. Can you send messages to nil? What happens when you do? What value, if any, is returned?

  -- GG
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Prev by Date: Re: How to get a NSButton (check box) state
  • Next by Date: Re: How to get a NSButton (check box) state
  • Previous by thread: Re: How to get a NSButton (check box) state
  • Next by thread: Add app to "launch on startup" list via AppleScript
  • Index(es):
    • Date
    • Thread