Click to See Complete Forum and Search --> : Create Radio Button in Parent window Client Area
keenlearner
May 7th, 2007, 05:56 AM
I was thinking how to create radio button in the parent window client area without using dialog box with visual c++ editor. In contrast, is it possible to use createWindowEx() function ? What are the class name and window style, and then how can I group the radio button. I googled but most of them using dialog box. Thanks.
Zaccheus
May 7th, 2007, 08:49 AM
Yes, you can create controls as child windows.
Here is the full documentation of all the controls:
http://msdn2.microsoft.com/en-us/library/ms649776.aspx
For example - to create a radio button you use CreateWindow with the class "BUTTON" and the style WM_CHILD | BS_AUTORADIOBUTTON .
keenlearner
May 7th, 2007, 09:37 AM
Thanks for the info, that is very helpful, I just realize that my local msdn library is not as complete as the online msdn. Do you know how can I update my msdn library ? Thanks.
Zaccheus
May 7th, 2007, 10:22 AM
Do you know how can I update my msdn library ?
Have you got the latest Platform SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en) ? It should include all that documentation.
keenlearner
May 8th, 2007, 12:03 AM
Yeah, mine has older version, I am going to download the latest one.
So about the radio button, I know how to create the radio button and groupbox with,
CreateWindowEx(0, WC_BUTTON, "Business", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
c_xBorder, 0, 100,50, g_hwnd, NULL, NULL, NULL);
CreateWindowEx(0, WC_BUTTON, "Class", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
c_xBorder, c_yBorder, 50, 200, g_hwnd, NULL, NULL, NULL);
But don't know how to associate the radio button into the group box. And I can't resize the groupbox to what I want. Can help ? thanks.
Zaccheus
May 9th, 2007, 08:24 AM
Sorry, I should have said BS_RADIOBUTTON. You get a WM_COMMAND whenever the radio button is clicked and while handling that message you can set the checked states of the related buttons in your code.
Alternatively, if you want to continue using BS_AUTORADIOBUTTON, you could specify the group boxes as the parents of the corresponding radio buttons, but I have not tried this myself.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.