Dumb question about radio buttons
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