How do you link a variable to a group of radio buttons... I want to an integer to -1 in a dialog constructor, then set the value to 0-5 depending on the radio button selected?
Printable View
How do you link a variable to a group of radio buttons... I want to an integer to -1 in a dialog constructor, then set the value to 0-5 depending on the radio button selected?
Using just the basic Windows API, in short, you don't link a variable to a group of radio buttons. If you're not using auto radio buttons (it's a button style), then you also have to check and uncheck the buttons as the user clicks. Otherwise, it'll do that automatically, assuming you've set it up correctly.
If you're using MFC, I'm not sure (you mention a dialog constructor).
Now, to set a variable to a radio buttons 'value', in Win32 API, you can either send a BM_GETCHECK to each individual radio button to test if it's marker or not when you need the value, or (probably easier) update a variable every time you receive a WM_COMMAND with one of the related radio buttons.