Stupid Radio Buttons!

Nibbie
Posts: 2
Joined: 2008.12
Post: #1
Howdy

I'm using the Interface builder to make a settings screen for my program. It's all working nicely, except for the stupid radio buttons.

You see, I have it in the code to activate/deactivate different sliders, buttons etc depending on the selection of a set of radio buttons. It works, but it seems that when the value fo the radio buttons changes, the first click doesn't work, but the second does.

I'm not sure I'm making any sense. What happens is, you click option 1 and it activates all the option 1 stuff, then you click option 2 and altho the dot moves to option 2 nothing happens. Click option 2 AGAIN, and then the changes take place.

From debugging I've found that BOTH options say they are active when you make a change of selection. But then how do you know which one is truly active? And why does the 2nd click work?

I'm confused and frightened.

Any suggestions?

Thanks in advance!!

Rob.
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2008.12
Post: #2
I should just say that I've tried a few different way to check which is active. I've tried making a connection for each option, then checking [idOption1 state] == NSOnState, and I've also tried just making a connection for the matrix and checking [[idMatrix cellAtRow: 0 column: 0] intValue] but I have the same problem with both.

Thanks!
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #3
Instead of querying the radio buttons' state, you'd probably be better off using the action sent by the radio button to set an internal state, and using that for reference. This is what I've always done, and radio buttons in Cocoa have never given me any trouble.

- Alex Diener
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2008.12
Post: #4
Ahh ok. Yeah that's a good idea. Thanks a lot!

Rob.
Quote this message in a reply
Member
Posts: 196
Joined: 2003.10
Post: #5
Themsalltook's course of action is a good one.

I agree, that drawing connections between radio buttons and querying their states is not intuitive. I believe it's because they act like buttons when we want them to be a graphical switch statement. I've found the easiest way is to query selectedRow on the NSMatrix that houses them. Only one connection, and all the functionality that you want/need. Still, the button action is more logical.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Very stupid question about Python on OS X Durandal 10 8,304 Dec 17, 2008 09:33 AM
Last Post: Duane
  Possibly Stupid newb questions... forgive me! UselessRob 8 3,940 Apr 7, 2005 08:41 PM
Last Post: UselessRob