i have implemented an NSMatrix of checkboxes and had an outlet that points to it in IB. 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 for setting and checking, 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.
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);
}