Does MFC have Member Variable for RadioButton? [Resolved]
The RadioButton is present in the Controls palette as well as other familiar controls. But I can't assign a member variable to the radio button although I can to the other controls (I've used -- Button, EditBox StaticText).
I've assigned them their own ID "IDC_RADIO1_LAN" and another as "IDC_RADIO2_Internet", but they don't show up in the ClasWizard Control ID's under the Member Variables tab. The Object ID's exist un the Message Maps tab.
Shouldn't I be able to get something like m_LAN.Checked=TRUE or m_Internet.Checked=FALSE ? (Where m_~~~ is my assigned member variable)?
I saw a few other MFC threads. Looks like we don't like MFC here. I decided to try it again after I got pretty good at Java. I'm trying to get a chat program going in MFC. I was successfull in VB and Java but actually my disappointment in MFC led me to learn Java and hate MS. But now I crave the speed of C++. The scribble tutorial is making sense now, but I didn't go through it all--only enough to get started again. I seem to have missed the radiobutton example.
Checking the Group property allows a member variable to be set for a radio button
Thanks for your efforts. I'll also be posting a new MFC headache I'm having soon.
I didn't compile your code because the problem I have is seeing the Control ID appear in the ClassWizard under the Member Variable tab in the first place. In fact, I don't see your "IDC_RADIO2" there either. How were you able to create any member variable for the radiobutton?
I see your IDC_RADIO2 Object ID under the Message Maps tab in ClassWizard and I see a IDC_RADIO3 when I add a third radio button control.
As far as saving the workspace, maybe you have a point there; I generally just hit a build option which says "the file is out of date, do you wish to rebuild them?"
I just compiled your code, but I guess I didn't have to. I'm sort of getting it now. It is about which control has the "Group" checkbox set in the Properties box for that control. If I knew what I was doing, your first answer would have sufficed
From the Help:
Quote:
Group
Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls in the tab order after the first control with the Group property set to False belong to the same group. The next control in the tab order with Group set to True ends the first group of controls and starts the next group. Type: Bool. Default: False.
I was setting the GroupBox as having the Group property check box set and I wasn't finding a member variable for the radiobuttons. Now I see from your settings that I shouldn't care about the group graphic, and I should just set a radio button with the group property set, then I'll have a member variable(s) for the radio.
Thanks!
The resolution is:
Checking the Group property for a radio button in this resource Properties dialog box allows a member variable to be set for this radio button.