Radio buttons MSVC 2003 not working like I think they should.

This is a discussion on Radio buttons MSVC 2003 not working like I think they should. within the Windows Programming forums, part of the Platform Specific Boards category; I thought that I could have multiple 'groups' of radio buttons like the following picture. Where one and only one ...

  1. #1
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396

    Radio buttons MSVC 2003 not working like I think they should.

    I thought that I could have multiple 'groups' of radio buttons like the following picture. Where one and only one in each group can be selected.
    Apparently I don't understand how MSVC 2003 implements the gouping of the radio buttons so it can keep only one button in each group checked.

    Or am I on the wrong track.

    /edit.
    I can select all of the radio buttons at once. Definately not what I want.
    Attached Images Attached Images  
    Last edited by Bajanine; 12-10-2006 at 02:25 PM.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  2. #2
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Create a groupbox around the set of buttons:
    _I'm a groupbox____
    | o Radio 1________|
    | o Radio 2________|
    | o Radio 3________|
    | o Radio 4________|
    | o Radio 5________|
    _________________
    _I'm another groupbox____
    | o Different Radio 1______|
    | o Different Radio 2______|
    | o Different Radio 3______|
    | o Different Radio 4______|
    | o Different Radio 5______|
    _______________________
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  3. #3
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    'Door Type', 'Rail 'Stile" and 'Options' are group boxes!
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  4. #4
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Oh, I thought you were asking how you could do that mmm, I thought that's how it worked
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  5. #5
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    From the reading I have done I would assume that it is correct! But like I say I have never implemented more that one group of radio buttons in the same dialog.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  6. #6
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    That's what I always thought. Have you looked for radio buttons/groupboxs on MSDN?
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  7. #7
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Yes, the only thing I found was:
    The RadioButtonGroup control should not overlap other controls and other controls should not overlap a RadioButtonGroup. Overlapping this control and another can cause the controls to function or display incorrectly.
    Of course I double checked and my controls are not overlapping so I don't know what is going on.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  8. #8
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Well I still don't understand what is wrong but as a work around I am handling each radio button manually and checking and unchecking with 'CheckRadioButton', which appears to be working.

    Thanks for the help.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  9. #9
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Are you using BS_AUTORADIOBUTTON style for your radio buttons? This creates a radio button that, when selected by a user, clears all other buttons in the same group.

  10. #10
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,672
    You setup Radio groups by using the "group" property of each control.

    First you want to make sure your tab order is good - each radio button should follow the other in the tab order. In MSVC, you can set the tab order by hitting Ctrl-D while in the dialog editor.

    Next you want to turn off the "group" property for all Radio buttons except the first Radio button in each logical group. So "Regular", "190 Narrow", and "Standard" should have their "Group" property set.

    Now that you've set where a logic group starts in the tab order, you now need to set where the logical group ends. From the help:
    Group
    Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls in the tab order after the first control with the Group property set to False belong to the same group. The next control in the tab order with Group set to True ends the first group of controls and starts the next group.
    So for example, assuming the "Head Rail" control follows the "Custom" radio button in the tab order - "Head Rail" should have the "Group" property set to end the logical group containing "Standard" and "Custom".

    Once your tab order and grouping are in place, the system will take care of only allowing one selection in a group.

    Another thing that helps is "testing" a dialog within MSVC by hitting "Ctrl-T" while in the dialog editor.

    gg

  11. #11
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Very, very informative Codeplug I will give that a try. I didn't realize that is how groups are set up in MSVS. I did lots of reading on MSDN and never found this information. Anyway, thanks again!
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Remote debug not working in Visual Studio 2003
    By Bassquake in forum Tech Board
    Replies: 12
    Last Post: 08-22-2008, 12:11 PM
  2. Replies: 8
    Last Post: 01-18-2008, 03:06 AM
  3. memcpy working strangely in msvc 2005
    By *DEAD* in forum C++ Programming
    Replies: 1
    Last Post: 06-15-2007, 09:50 AM
  4. Comments problem with MSVC 2003
    By mikahell in forum Tech Board
    Replies: 7
    Last Post: 09-04-2006, 06:04 PM
  5. Radio Buttons in Visual C++ 6
    By Ripper1 in forum Windows Programming
    Replies: 22
    Last Post: 05-16-2003, 07:54 AM

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