jobrems
asked on
How can I select a radio button programmatically in MFC?
Can I use SendDlgItemMessage()?
I see there is a CButton::SetCheck() method - but I don't see how to reference the button object created by the Resource editor. How can I ue SetCheck?
I see there is a CButton::SetCheck() method - but I don't see how to reference the button object created by the Resource editor. How can I ue SetCheck?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
... or for a group of radio buttons you just create (the same way as above with 'AddVariable') an UINT member variable. You then can set this to be 0 for the first radio button, 1 for the second a.s.o. and call 'UpdateData(FALSE)' to set it - call 'UpdateData(TRUE)' later to recieve in that UINT variable which button was checked by the user.
ZOPPO
ZOPPO
ASKER
Quick and easy solution - thanks!
Add to ZOPPO's comment.
The member variable must be associated to the first radio button in the group.
The member variable must be associated to the first radio button in the group.
BTW, there's another option too: You can generate a CButton member with 'ClassWizard->Variables->A