I know that I can create an integer variable for a group of radio buttons, set it to an integer, and then call UpdateData(FALSE) to make the window highlight the appropriate radio button control. However, I would like to perhaps use a CButton control instead, but I don't know how to set the CButton state so that a particular radio button of the group is checked. Is it even possible to do so for MFC? Thanks in advance.
0
votes
1 Answers
0
votes
As I only need to set the states upon startup or reset states, I linked the CButton control with the appropriate id flag for the CButton control before switch them to on. The CButton control can later contain other values as onclicked() handlers are used for me to map selected radio button values properly.
void UserControls::DoDataExchange(CDataExchange* pDX)
{
...
// Mapping the integer variables to the Radio control for proper
// displaying
// not the id of the first radio button of the group for both of them
DDX_Control(pDX, IDC_NOBTL, nobCtrl);
DDX_Control(pDX, IDC_UIHARD, uiCtrl);
...
}