Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFC multiple radio buttons groups on dialog

I have 2 groups of radio boxes on a dialog. How can I specify which button is in which group? Because right now when I select one, all the others get unselected, even the ones from the other group.

like image 805
melculetz Avatar asked Feb 18 '10 12:02

melculetz


People also ask

How do I group radio buttons in MFC?

Step 1 − Drag a group box and three radio buttons and remove the Caption of Static Text control. Step 2 − Add event handler for all the three radio buttons. Step 3 − Add the Value variable for the Static Text control. Step 4 − Here is the implementation of three event handlers.

How do you group radio buttons together?

You group radio buttons by drawing them inside a container such as a Panel control, a GroupBox control, or a form. All radio buttons that are added directly to a form become one group. To add separate groups, you must place them inside panels or group boxes.

Can radio buttons have multiple selections?

Radio buttons allow a user to select a single option among multiple options. You can set the Choice Value of each option, for each button, as well as group these buttons by giving them the same Group Name.

Why can I select multiple radio buttons?

Only one radio button in a group can be checked. You have two radio buttons with different names. This means that you have two radio groups, each containing one radio button. You need to put them in the same group (by making them share a name) if you only want one of them to be selected.


1 Answers

The tab order of the dialog, and the Group property completely dictates which radio buttons belong to which groups.

Each radio button belongs to the group of the previous main radio button in the tab order. The main radio button has the Group property set to True.

You can set the tab order by going to the dialog editor and pressing Ctrl+D. You then click on each control from 1 to N in the order you want the tabbing to go.

like image 91
Brian R. Bondy Avatar answered Sep 21 '22 09:09

Brian R. Bondy