locked
Question to Radio button RRS feed

  • Question

  • Hi,
    I have the following separate Radio buttons


    on Dialog form. Is it having anything wrong, as there should be only one option being selected, each time?

    Many Thanks & Best Regards, Hua Min

    Friday, May 29, 2015 3:18 PM

Answers

  • I think you missed to set the Group property to true for the first radio button.

    Following is the text from MSDN.

    To add a group of radio buttons to a dialog box

    1. Select the radio button control in the Toolbox Window and click the location in the dialog box where you want to place the control.

    2. Repeat Step 1 to add as many radio buttons as you need. Make sure that the radio buttons in the group are consecutive in the tab order (for more information, see Changing the Tab Order of Controls).

    3. In the Properties Window, set the Group property of the first radio button in the tab order to True.

      Changing the Group property to True adds the WS_GROUP style to the button's entry in the dialog object of the resource script and ensures that a user can only select one radio button at a time in the button group (when the user clicks one radio button, the others in the group are cleared).


    sivanitha

    Friday, May 29, 2015 3:20 PM

All replies

  • I think you missed to set the Group property to true for the first radio button.

    Following is the text from MSDN.

    To add a group of radio buttons to a dialog box

    1. Select the radio button control in the Toolbox Window and click the location in the dialog box where you want to place the control.

    2. Repeat Step 1 to add as many radio buttons as you need. Make sure that the radio buttons in the group are consecutive in the tab order (for more information, see Changing the Tab Order of Controls).

    3. In the Properties Window, set the Group property of the first radio button in the tab order to True.

      Changing the Group property to True adds the WS_GROUP style to the button's entry in the dialog object of the resource script and ensures that a user can only select one radio button at a time in the button group (when the user clicks one radio button, the others in the group are cleared).


    sivanitha

    Friday, May 29, 2015 3:20 PM
    1. ...

    2. ...

    3. In the Properties Window, set the Group property of the first radio button in the tab order to True.



    sivanitha

    Thanks. Should I change Group property of all radio buttons to True?

    Many Thanks & Best Regards, Hua Min

    Saturday, May 30, 2015 8:01 AM
    1. ...

    2. ...

    3. In the Properties Window, set the Group property of the first radio button in the tab order to True.


    sivanitha

    Thanks. Should I change Group property of all radio buttons to True?

    If you want to assign CButton control variables to each button, I think you need to temporarily set the group property to true for each button.

    Then remove the group property for all buttons in the group except the first.

    Also, check that the buttons are consecutive in the tab order.


    David Wilkinson | Visual C++ MVP

    Saturday, May 30, 2015 10:50 AM