NSButton checkbox reports reverse state
NSButton checkbox reports reverse state
- Subject: NSButton checkbox reports reverse state
- From: mirage_3d <email@hidden>
- Date: Mon, 16 Jun 2008 13:50:58 +0800
hi there,
i have implemented an NSMatrix of checkboxes and had an outlet point to it.
in my code i have changed the appearance of the buttons as well as their
states in awakeFromNib. when i check the buttons' states in my action
however, the buttons report the inverse state to what they really should. i
used NSOffButton and NSOnButton constants to set and check, and the values
are correct. but when i check the buttons' states later on they just report
the opposite. i'm lost as to where to look to track what's going on or
debug. any ideas as to why this might happen ?
here's the logic and flow of my code.
appocontroller init
appcontroller awakefromnib
wait for user input
user checks box
IBAction called
get button cell from nsmatrix
check state using whitch/case
wrong case gets called
i even tried to flip the button's state inside the switch/case and nslog
reports the same opposite behavior.
here's my IBAction...
- (IBAction)setCheckBoxOptions:(id)sender
{
// NSLog(@"setOptions: Checkbox: %d was called by: %@", [[sender
selectedCell] tag], sender);
// NSButton *optionBox = [sender selectedCell];
NSButton *optionBox = [sender selectedCell];
switch ([optionBox state]) {
case NSOffState:
NSLog(@"optionBox \"%@\": %d", [optionBox title], [optionBox state]);
// [optionBox setState:NSOnState];
NSLog(@"case 1: setOptions: optionBox: %d to %d", [optionBox tag], NSOnState
);
break;
case NSOnState:
NSLog(@"optionBox \"%@\": %d", [optionBox title], [optionBox state]);
// [optionBox setState:NSOffState];
NSLog(@"case 2: setOptions: optionBox: %d to %d", [optionBox tag],
NSOffState);
break;
case NSMixedState:
default:
// [optionBox setState:NSOffState];
NSLog(@"case 3: setOptions: Mixed optionBox: %d to %d", [optionBox tag],
NSOffState);
break;
}
NSLog(@"NSOnState = %d", NSOnState);
NSLog(@"NSOffState = %d", NSOffState);
}
mirage3d
_______________________________________________
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