RadioButtonGroup Control

Windows Installer

RadioButtonGroup Control

The RadioButtonGroup control is a group of radio buttons. It enables the user to select a string or integer value for a property from a predetermined list of values. You can associate this control with a property by entering the property's name into the Property column of the Control table. Specify the possible values for selection in the Value column of the RadioButton table. Note that the string displayed is not necessarily the same as the value that the user is choosing.

Every RadioButtonGroup control is associated with a property. The default value for this property must be initialized in the Property table. Within each RadioButtonGroup specified in the RadioButton table, there may be one radio button that has a value in the Value field that matches the default value for this property. This is the default button for the RadioButtonGroup control. The Default button is initially shown as selected in the control.

Note that the focus on a dialog box cannot move to a RadioButtonGroup control until one of the buttons in the group has been selected. To make the focus move to this button group, specify one of the buttons as a default button for the group.

RadioButtonGroup controls only set property values and cannot be used to send a ControlEvent.

The implementation treats the whole group as one control, therefore it is not possible to hide or disable individual buttons within the group. Similarly all the buttons have to be of the same style, that is, either all of them have text or all of them have bitmaps (or other similar features). The position of the buttons is authored relative to the group. This way the entire group can be moved by changing only the coordinates of the group without changing the individual buttons. At creation the control verifies that the individual buttons do not extend beyond the boundaries of the group.

Control Attributes

You can use the following attributes with this control. To change the value of an attribute using an event, subscribe the control to a ControlEvent in the EventMapping table and list the attribute's identifier in the Attribute column. Enter the identifier of the ControlEvent in the Event column.

Attribute identifier Hexadecimal bit Description
IndirectPropertyName This is the name of an indirect property associated with the control. If the Indirect attribute bit is set, the control displays or changes the value of the property having this name. If the Indirect attribute bit is set, this name is also the value of the property listed in the Property column of the Control table.
Position Position of the control in the dialog box.

Enter the control's width, height, and coordinates of the control's left corner into the Width, Height, X, and Y columns of the Control table. Use installer units for length and distance.

PropertyName   This is the name of the property associated with this control. If the Indirect attribute bit is not set, the control displays or changes the value of the property having this name. This attribute is specified in the Property column of the Control table.
PropertyValue Current value of the property displayed or changed by this control. If the Indirect attribute bit is not set, this is the value of PropertyName. If the Indirect attribute bit is set, this is the value of IndirectPropertyName. If the attribute changes, the control reflects the new value.
Text This control attribute can specify the text displayed by the control, an image stored in the Binary table, or an image set at run time.

To specify text, enter the text string into the Text column of the Control table. To set the font and font style of this text, prefix the string of displayed characters with {\style} or {&style}. Where style is an identifier listed in the TextStyle column of the TextStyle table. If neither of these are present, but the DefaultUIFont property is defined as a valid text style, that font will be used.

To specify an icon or bitmap image stored in the Binary table enter the primary key of the image's record from the Name column of the Binary table into the Text column of the Control table record for the control.

Visible 0x00000000

0x00000001

Hidden control.

Visible control.

Include this bit in the bit word of the Attributes column in the Control table to make the control visible or hidden upon its creation.

You can also hide or show a control by using the ControlCondition table.

Enabled 0x00000000

0x00000002

Control in a disabled state.

Control in an enabled state.

Include this bit in the Attributes column of the Control to enable the control on creation.

You can also enable or disable a control by using the ControlCondition table.

Sunken 0x00000000

0x00000004

Displays the default visual style.

Displays the control with a sunken, 3-D, look.

Include these bits in the bit word in the Attributes column of the Control table.

Indirect 0x00000000

0x00000008

The control displays or changes the value of the property in the Property column of the Control table.

The control displays or changes the value of the property that has the identifier listed in the Property column of the Control table.

Determines if the property associated with this control is referenced indirectly.

Integer 0x00000000

0x00000010

Property associated with the control is a string value.

Property associated with the control is an integer value.

Include this bit in the bit word of the Attributes column of the Control table to set this attribute on creation of the control.

RTLRO 0x00000000

0x00000020

Text in the control is displayed in left-to-right reading order.

Text in the control is displayed in right-to-left reading order.

RightAligned 0x00000000

0x00000040

Text in the control is aligned to the left.

Text in the control is aligned to the right.

PushLike 0x00000000

0x00020000

Control is drawn with its usual appearance.

Control has the BS_PUSHLIKE style, and is drawn to appear as a push button.

Include this bit in the bit word of the Attributes column of the Control table to set this attribute on creation of the control.

Bitmap 0x00000000

0x00040000

Text in the control is specified in the Text column of the Control table.

The control has the BS_BITMAP style, text in the control is replaced by a bitmap image. The Text column in the Control table is used as a foreign key to the Binary table.

Include this bit in the bit word in the Attributes column of the Control table.

Do not set the Icon and Bitmap style bits simultaneously. The button cannot contain both a bitmap image and text.

To set the font and font style of a text string, prefix the string of displayed characters with {\style} or {&style}. Where style is an identifier listed in the TextStyle column of the TextStyle table. If neither of these are present, but the DefaultUIFont property is defined as a valid text style, that font will be used.

Icon 0x00000000

0x00080000

Text in the control is specified in the Text column of the Control table.

The control has the BS_ICON style, text in the control is replaced by an icon image. The Text column in the Control table is used as a foreign key to the Binary table.

Include this bit in the bit word in the Attributes column of the Control table.

Do not set the Icon and Bitmap bits simultaneously. The button cannot contain both an icon image and text.

To set the font and font style of a text string, prefix the string of displayed characters with {\style} or {&style}. Where style is an identifier listed in the TextStyle column of the TextStyle table. If neither of these are present, but the DefaultUIFont property is defined as a valid text style, that font will be used.

FixedSize 0x00000000

0x00100000

Stretch the icon image to fit the control.

Crop or center the icon image in the control.

Include this bit in the bit word of the Attributes column of the Control table.

IconSize 0x00000000

0x00200000

0x00400000

0x00600000

Loads the first image.

Loads the first 16x16 image.

Loads the first 32x32 image.

Loads the first 48x48 image.

An icon file can contain different size images of the same icon. Include the value of the appropriate bit word in the Attributes column of the Control table

If these bits are not set, the installer ignores the FixedSize attribute and the image is stretched to fit the control rectangle. If both the IconSize bits and the FixedSize bits are set, an image smaller than the control is centered and an image is larger than the control it is shrunk to fit.

HasBorder not set

0x01000000

No border and no text.

Displays border and text.

Include 16777216 in the bit word in the Attributes column of the Control to display a border and text.

 

Remarks

Because of the way Windows draws the frame, there is a gap between the top of the control's window and the visible frame, even when there is no caption.

This control can be created from the BUTTON class by using the CreateWindowEx function. If the HasBorder bit is set, it has the BS_GROUPBOX style, otherwise it has the BS_OWNERDRAW style.

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. To provide screen-reader programs with extra descriptive text about a RadioButtonGroup control, follow the example provided in Adding Extra Text to Radio Buttons.

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.