serveral radio buttons groups on the same dialog
-
Hi, I'm a beginner with VC++ 6.x and I'm becoming crazy. I don't know how to manage several group of radio buttons on the same dialog box... it seems that evey radio buttons are included in the same unique group ! Any ideas ??? thanks !
-
Hi, I'm a beginner with VC++ 6.x and I'm becoming crazy. I don't know how to manage several group of radio buttons on the same dialog box... it seems that evey radio buttons are included in the same unique group ! Any ideas ??? thanks !
In short, radio buttons are lumped together by their WS_GROUP style. In the old days, you could do something like:
CheckRadioButton (hDlg, IDC_FIRSTONE, IDC_LASTONE, idCheckedOne);
CheckRadioButton (hDlg, IDC_FIRSTTWO, IDC_LASTTWO, idCheckedTwo);But you would have to make sure you had non overlapping ids. It was also a pain to find out which button was set in each group. You can now use
DDX_Radio (pDX, IDC_FIRSTONE, nCheckOne);
DDX_Radio (pDX, IDC_FIRSTTWO, nCheckTwo);in your CMyDlg::DoDataExchange method. To associate buttons in a group together, first make sure every control in your dialog has the group style bit checked. Then set the tab order (ctrl-d) so that successive radio buttons have successive order. Last but not least clear the group style bit for all radio buttons except the first in each group. Good luck, Iain.
-
In short, radio buttons are lumped together by their WS_GROUP style. In the old days, you could do something like:
CheckRadioButton (hDlg, IDC_FIRSTONE, IDC_LASTONE, idCheckedOne);
CheckRadioButton (hDlg, IDC_FIRSTTWO, IDC_LASTTWO, idCheckedTwo);But you would have to make sure you had non overlapping ids. It was also a pain to find out which button was set in each group. You can now use
DDX_Radio (pDX, IDC_FIRSTONE, nCheckOne);
DDX_Radio (pDX, IDC_FIRSTTWO, nCheckTwo);in your CMyDlg::DoDataExchange method. To associate buttons in a group together, first make sure every control in your dialog has the group style bit checked. Then set the tab order (ctrl-d) so that successive radio buttons have successive order. Last but not least clear the group style bit for all radio buttons except the first in each group. Good luck, Iain.
That's it ! so hard to find such information in the Visual C++ documentation... it saves me a lot of time ! Many thanks