Selecting default Radio Button in Group Box 
Author Message
 Selecting default Radio Button in Group Box

Visual C++ v6.0
  Resource Editor
    Building a RadioButton list inside a GroupBox.

I can't figure out how to specify a default RadioButton for the
GroupBox.  When the application starts they are all blank.

Class Wizzard won't let you create controls for the Radio Buttons so I
can't access the default Radio Button when the form initializes.

This is driving me nuts!  I can't believe this is so difficult to figure
out.  Does everyone run into this problem with grouped radio buttons?

Any help would be appreciated.



Mon, 27 Oct 2003 01:23:00 GMT  
 Selecting default Radio Button in Group Box

Quote:

> Visual C++ v6.0
>   Resource Editor
>     Building a RadioButton list inside a GroupBox.

> I can't figure out how to specify a default RadioButton for the
> GroupBox.  When the application starts they are all blank.

> Class Wizzard won't let you create controls for the Radio Buttons so I
> can't access the default Radio Button when the form initializes.

> This is driving me nuts!  I can't believe this is so difficult to figure
> out.  Does everyone run into this problem with grouped radio buttons?

> Any help would be appreciated.

The class wizard will let you add an integer variable, which you then
set to 0 or 1 (I can't remember what base value the group starts at).
Numbers outside the range of the group result in no buttons being set.  
Remember to call UpdateData(false) after setting such values, as well as
UpdateData(true) before reading or writing any.

--
Regards,


Systems and Processing Group,       Tel: +44-20-8420-3523
Sensor Systems Division,            Fax: +44-20-8420-3960
BAE SYSTEMS Avionics Limited,
The Grove, Warren Lane,
Stanmore, Middlesex.
HA7 4LY, England.

http://joe.hotchkiss.com



Mon, 27 Oct 2003 01:55:04 GMT  
 Selecting default Radio Button in Group Box

Quote:

> Class Wizzard won't let you create controls for the Radio Buttons so I
> can't access the default Radio Button when the form initializes.

Just insert an integer for this control with the class-wizard. Now you
can do

m_RadioButton = 0;

in your class's constructor. 0 = 1st radio button, 1 = 2nd radio button
and so on.

cu bart

--
http://www.irule.be/bvh/



Mon, 27 Oct 2003 07:21:06 GMT  
 Selecting default Radio Button in Group Box
To add to Joe's answer, this can be changed in the dialog class ctor, where
the value is -1 by default. It starts at 0, btw :-)

Johan Rosengren
Responsable Informatique
PACTA S.A.


Quote:

> > Visual C++ v6.0
> >   Resource Editor
> >     Building a RadioButton list inside a GroupBox.

> > I can't figure out how to specify a default RadioButton for the
> > GroupBox.  When the application starts they are all blank.

> > Class Wizzard won't let you create controls for the Radio Buttons so I
> > can't access the default Radio Button when the form initializes.

> > This is driving me nuts!  I can't believe this is so difficult to figure
> > out.  Does everyone run into this problem with grouped radio buttons?

> > Any help would be appreciated.

> The class wizard will let you add an integer variable, which you then
> set to 0 or 1 (I can't remember what base value the group starts at).
> Numbers outside the range of the group result in no buttons being set.
> Remember to call UpdateData(false) after setting such values, as well as
> UpdateData(true) before reading or writing any.

> --
> Regards,


> Systems and Processing Group,       Tel: +44-20-8420-3523
> Sensor Systems Division,            Fax: +44-20-8420-3960
> BAE SYSTEMS Avionics Limited,
> The Grove, Warren Lane,
> Stanmore, Middlesex.
> HA7 4LY, England.

> http://joe.hotchkiss.com



Mon, 27 Oct 2003 02:23:38 GMT  
 Selecting default Radio Button in Group Box

Quote:
> I can't figure out how to specify a default RadioButton for the
> GroupBox.  When the application starts they are all blank.

I use this;

        CheckRadioButton(1001,1003,1001);

Where 1001 to 1003 is my group of 3 buttons, 1001 is the one I want on by
default (you can get these values out of resource.h).

--
Lordy
http://www.overlord-uk.com/



Tue, 28 Oct 2003 01:05:42 GMT  
 Selecting default Radio Button in Group Box
Hi!

If you use MFC - as I assume writing into THIS group -
you probably will have a dialog member, e.g.
m_nMyRadioGroup, assigned to your radio button group,
don't you?

If yes, you simply should change class wizard's initialization
of this member from -1 to 0, o - better still - fille the member
with the value you want to have it, e.g.
dlg.m_nMyRadiopGroup = 2 // for the third button

Regards, Pi.



Tue, 28 Oct 2003 13:59:48 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. check a single radio button in a radio-button-group

2. determining which radio button selected in group?

3. Group Boxes w/ Radio Buttons

4. How do i create (in runtime) two radio buttons in a group box

5. Radio button and Group Box

6. strange radio button select and de-select behaviour

7. Disabling groups of Radio buttons?

8. How To Make Groups Of Radio Buttons Exclusive?

9. tabbing into radio button group

10. Adding radio button to a group

11. Grouped Radio Buttons, Enable and Disable

12. initializing radio button groups

 

 
Powered by phpBB® Forum Software