How do i make two groups of radioButton in the same form?
VC++
This is a discussion on VS2008"Windows forms application" within the Windows Programming forums, part of the Platform Specific Boards category; How do i make two groups of radioButton in the same form ? VC++...
How do i make two groups of radioButton in the same form?
VC++
Last edited by almawajdeh; 05-31-2010 at 01:57 PM.
The trick is easy, set the style WS_GROUP to each first control of each group; I haven't tryed with a template but I suppose that will be the same:
Sorry if the code is a little wide. Also it is recommended to combine the WS_GROUP style with WS_TABSTOP, so the user can browse between groups through the tab key.Code:CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_AUTORADIOBUTTON,10,10,100,20,hwnd,(HMENU)1000,0,0); CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON,10,30,100,20,hwnd,(HMENU)1001,0,0); CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON,10,50,100,20,hwnd,(HMENU)1002,0,0); CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_AUTORADIOBUTTON,110,10,100,20,hwnd,(HMENU)1003,0,0); CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON,110,30,100,20,hwnd,(HMENU)1004,0,0); CreateWindowEx(0,"BUTTON","",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON,110,50,100,20,hwnd,(HMENU)1005,0,0);
Hope that helps
Niara
Windows Forms Applications aren't your vanilla Windows dialogs. Niara, your code might work for a C/C++ application who dynamically create a window, but this isn't a dynamically created window.
Windows Forms Applications is a special type of template that you edit in an editor. It's also C++/CLI or other dotCrap languages. It is NOT, and I repeat, NOT, C++ or C.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
yes Elysia, I work with VS2008 "Windows Forms Application",
and Thank you Niara
In the Forms editor, put a group box around the radio buttons you want together.
Ok, sorry Elysia and almawajdeh for the confusion (better read ignorance instead confusion)
But as DaveH say, isn't there an option to grouping controls?
Niara
The option is to put a group box around controls you want grouped together.
yes DaveH , it's work
I brought another way which is " Panel" it is like" GroupBox "
Thank you