Click to See Complete Forum and Search --> : radio buttons


dmcdowell
May 11th, 1999, 08:04 PM
I have a propertysheet that contains three radio buttons all grouped together. does anyone know of a way to figure out which radio button has been selected and also how to get the value of that radio button. I need to save the vales to the registry so I can use them at a later date when I restart the application.

Cheers

Jaeyeon Lee
May 11th, 1999, 09:11 PM
If you are using Visual C++, you can associate the radio button group to a member variable.
Look at the Class Wizard / Member Variables section, then you may find the ID of the first
radio button control. Associate it with an integer variable.

When you call UpdateData(TRUE) from your dialog box, the integer value will be 0 if the first
radio button is selected, 1 if the second is selected, and so on.

Le Sant Yves
May 12th, 1999, 05:05 AM
Very easy is to find out which button is pressed:

int id;
id=GetCheckedRadioButton(ID_BFirst,ID_BLast);

id will be the ID number of the checked radio button. You must ensure that the first button ID_BFirst starts a group.

possible trouble
Buttons must be created in the right order, otherwise you have to manage by yourself number of ID in the resource file (be carefull!!!)

hope this will help

Yves Le Sant
Metrology and Measurement Unit
Fundamental and Experimental Aerodynamics Departement
ONERA Meudon
(Office National d'Etudes et de Recherches Aérospatiales)
FRANCE