[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide

RadioBox and CheckBox

RadioBoxes and CheckBoxes are collections of ToggleButtons. The primary difference is that in a RadioBox only one ToggleButton at a time can be set; in a CheckBox more than one ToggleButton can be set. In a RadioBox, a ToggleButton cannot be in an indeterminate state; in a CheckBox, a ToggleButton can be in an indeterminate state.

RadioBoxes and CheckBoxes are usually implemented as WorkAreas, though it is possible to implement them as menus. Usually the application intends for the box to remain visible after the user sets a ToggleButton, particularly in a CheckBox. The application can implement a transient RadioBox or CheckBox by placing a WorkArea inside a dialog.

The following RowColumn resources specifically control the behavior of a RadioBox or CheckBox:


When True, the RowColumn ensures that at most one ToggleButton is set at a time. Setting this resource to True also causes the ToggleButton resource XmNindicatorType to default to XmONE_OF_MANY and XmNvisibleWhenOff to default to True.


When both this resource and XmNradioBehavior are True, RowColumn ensures that one ToggleButton is always set. The user is not allowed to unset a ToggleButton when no other ToggleButton is set.

For a RadioBox implemented as a WorkArea, the default value for XmNisHomogeneous is True, and by default RowColumn allows only ToggleButton and ToggleButtonGadget children.

Note that the application can foil the RowColumn's enforcement of XmNradioBehavior and XmNradioAlwaysOne, even when these resources are True. The application can use XtSetValues to set the state of the ToggleButtons, and it can manage and unmanage ToggleButtons regardless of their state. The behavior of a RadioBox is undefined if the application takes actions that contradict XmNradioBehavior or XmNradioAlwaysOne.

XmCreateRadioBox creates a WorkArea RadioBox and initializes XmNradioBehavior to True.

A CheckBox is most often a collection of ToggleButtons in a WorkArea with XmNradioBehavior set to False. By default, the ToggleButton XmNindicatorType is XmN_OF_MANY and XmNvisibleWhenOff is True.

[ Previous | Next | Contents | Glossary | Home | Search ]