How to access Radio Button with just ID
-
I have a number of radio buttons. I want to enter their ID's in a std::map for later use. But I can't figure out how to set the correct button from it's ID. IOW, given a group consisting of 2 radio buttons and their ID's (IDC_R1, IDC_R2), does anyone know how to set which one is picked? Jack
-
I have a number of radio buttons. I want to enter their ID's in a std::map for later use. But I can't figure out how to set the correct button from it's ID. IOW, given a group consisting of 2 radio buttons and their ID's (IDC_R1, IDC_R2), does anyone know how to set which one is picked? Jack
-
I have a number of radio buttons. I want to enter their ID's in a std::map for later use. But I can't figure out how to set the correct button from it's ID. IOW, given a group consisting of 2 radio buttons and their ID's (IDC_R1, IDC_R2), does anyone know how to set which one is picked? Jack
I used to use the pointer method, and then one day I stumbled upon this function: UINT IsDlgButtonChecked( int nIDButton ) const; So, if you want to determine if the IDC_R1 button is checked, simply:
if (IsDlgButtonChecked(IDC_R1) != 0) AfxMessageBox("Checked");
:cool: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
-
CButton * butt = (CButton *) GetDlgItem(IDC_R1); CButton * head = (CButton *) GetDlgItem(IDC_R2); Regards,
-
I used to use the pointer method, and then one day I stumbled upon this function: UINT IsDlgButtonChecked( int nIDButton ) const; So, if you want to determine if the IDC_R1 button is checked, simply:
if (IsDlgButtonChecked(IDC_R1) != 0) AfxMessageBox("Checked");
:cool: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
-
Thanks, I appreciate you mentioning that. But the problem I was having had to do with setting it, not checking if it was set. Turns out I was setting it correctly but I was also not un-setting the other radio buttons. It's working fine now. Jack