• 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
NSButton reports reverse state
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSButton reports reverse state


  • Subject: NSButton reports reverse state
  • From: mirage_3d <email@hidden>
  • Date: Mon, 16 Jun 2008 17:45:45 +0800

hi there,

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.

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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSButton reports reverse state
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Interface Builder popularity w/ Cocoa Developers
  • Next by Date: OpenMP in Xcode
  • Previous by thread: Re: Interface Builder popularity w/ Cocoa Developers
  • Next by thread: Re: NSButton reports reverse state
  • Index(es):
    • Date
    • Thread