Re: NSButton (Switch)
Re: NSButton (Switch)
- Subject: Re: NSButton (Switch)
- From: Todd Heberlein <email@hidden>
- Date: Thu, 16 Aug 2001 11:39:14 -0700
On 8/16/01 11:35 PM, "stuartbryson" <email@hidden> wrote:
>
NSButton but neither work, they all return 0 regardless of what I
>
beleive is its state.
"state" should be the right method. I did a quick test and was able to
duplicate your problem: this happened when I disconnected the outlet to the
switch. You might want to see if you have a similar problem (i.e., is
everything connected right).
Here is the snippet I used to check the value:
NSLog(@"State: %d", [switch_button state]);
In your code you will probably want something like
if ([switch_button state] == NSOnState) {
// button is checked. Do stuff
}
else {
// button is not checked. Do something else
}
Todd