radio buttons
radio buttons
- Subject: radio buttons
- From: email@hidden (Jody Fairchild)
- Date: Sat, 29 Dec 2001 19:30:30 +0900
i seem to have discovered a situation where a multiple cells in a radio
group can return NSOnState at the same time. first i have to say that i
can't believe that this is not due to something i'm doing wrong, but it's
sufficiently weird that i'm asking the list.
i have a preferences window with a couple of radio groups. the radio
groups and a couple of other buttons are targeted (via ib) to a method in
my prefs controller which is supposed to map the current state of the
controls to their matching settings in the app. this works fine for the
checkboxes, but as i cycle through the cells for a radio group, i find that
_more than one_ claims to be "on"! the following code:
NSLog(@"opchange_handler, inside radio section, count = %i\n",
[[sender cells] count]);
for (i = 0; i < [[sender cells] count]; i++)
{ if ([[sender cellAtRow:i column:0] state] == NSOnState)
{ NSLog(@"opchange_handler, inside radio section loop, selected = %i\n",i);
// break;
}
}
(note the commented out for debugging purposes "break" above) generates the
following output (slightly altered to fit here):
opchange_handler, inside radio section, count = 4
opchange_handler, inside radio section loop, selected = 0
opchange_handler, inside radio section loop, selected = 1
it seems that clicking one of the buttons in the radio group (which is what
triggers the above code) sends the triggering event before (or maybe during
the process of) changing the states of the buttons. like i said, unless i'm
doing something really stupid, this seems like some kind of a bug to me.
can someone point me to a clue as to what's going on here? if you reply to the
list, please also cc <email@hidden>.
thanks,
-jf