tags:

views:

3569

answers:

3

When I'm initializing a dialog, I'd like to select one of the radio buttons on the form. I don't see a way to associate a Control variable using the Class Wizard, like you would typically do with CButtons, CComboBoxes, etc...

Further, it doesn't like a CRadioButton class even exists.

How can I select one of the several radio buttons?

+4  A: 

Radio buttons and check buttons are just buttons. Use a CButton control and use GetCheck/SetCheck.

mos
+2  A: 

Going on what mos said, the following worked did the trick:

CButton* pButton = (CButton*)GetDlgItem(IDC_RADIOBUTTON);
pButton->SetCheck(true);
Chris Karcher
Please vote his answer up, then.
Roel
+3  A: 

Use CheckRadioButton to set select one button in a group and GetCheckedRadioButton to retrieve the ID of the selected button.

ChrisN