VS2008"Windows forms application"

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++...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    14

    VS2008"Windows forms application"

    How do i make two groups of radioButton in the same form?
    VC++
    Last edited by almawajdeh; 05-31-2010 at 02:57 PM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    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:

    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);
    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.

    Hope that helps
    Niara

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,033
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    14
    yes Elysia, I work with VS2008 "Windows Forms Application",
    and Thank you Niara

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    In the Forms editor, put a group box around the radio buttons you want together.

  6. #6
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    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

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    The option is to put a group box around controls you want grouped together.

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    14
    yes DaveH , it's work
    I brought another way which is " Panel" it is like" GroupBox "
    Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Good introduction to Windows Forms?
    By jcafaro10 in forum C# Programming
    Replies: 1
    Last Post: 05-19-2009, 07:11 PM
  2. Replies: 2
    Last Post: 04-02-2009, 05:40 AM
  3. C# Forms
    By Xarzu Athanasop in forum C# Programming
    Replies: 2
    Last Post: 01-16-2008, 11:57 AM
  4. C# Game using Forms
    By ejohns85 in forum C# Programming
    Replies: 1
    Last Post: 12-16-2006, 05:35 PM
  5. Which one :MFC, Win32, Windows Forms (.Net)?
    By Robert_Sitter in forum Windows Programming
    Replies: 6
    Last Post: 11-17-2005, 06:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21