• 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
Dumb question about radio buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dumb question about radio buttons


  • Subject: Dumb question about radio buttons
  • From: William Squires <email@hidden>
  • Date: Thu, 23 Feb 2012 07:58:38 -0600

  I have a custom view with an NSBox containing an NSMatrix of button cells (radio buttons) When I created the NSMatrix, I told it I wanted 3 of them, but in the view hierarchy, I can see the NSMatrix under the NSBox, but it has 4 button cells under it, not the three I asked for - Is this an Xcode/IB screw-up, or do NSMatrix's always add one extra element when making a group of radio buttons? Should I delete the matrix and try again? When I vertically resize the matrix, I always see three cells, so I don't think there's one hidden under there.
  Also, even though I set the tag for each button cell (the top one is 0, the next one down is 1, etc...), when I connect them to my

-(IBAction)baseChanged:(id)sender
{
int choice = [sender tag];
switch (choice)
  {
  case 0: // number base is 16 - hexadecimal
          NSLog(@"user chose hexadecimal");
          ...
          break;

  case 1: // number base is 2 - binary
          NSLog(@"user chose binary");
          ...
          break;

  case 2: // number base is 10 - decimal
          NSLog(@"user chose decimal");
          ...
          break;
  }
self.numberBase = choice;
}

I always get, "user chose hexadecimal"! :( (all the buttons generate an action, so it's not that...)
  Am I supposed to connect the NSMatrix to the action, and not the individual cells? If so, how do I ask for the cell's tag value?



_______________________________________________

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


  • Follow-Ups:
    • Re: Dumb question about radio buttons
      • From: Gideon King <email@hidden>
    • Re: Dumb question about radio buttons
      • From: Graham Cox <email@hidden>
    • Re: Dumb question about radio buttons
      • From: Keary Suska <email@hidden>
    • Re: Dumb question about radio buttons
      • From: Seth Willits <email@hidden>
  • Prev by Date: Re: text field question
  • Next by Date: Was: Re: NSStepper - useless?
  • Previous by thread: Re: NSView mouseDown truncated coordinates
  • Next by thread: Re: Dumb question about radio buttons
  • Index(es):
    • Date
    • Thread