A CheckBox or a RadioBox can often present a set of choices to the user more effectively than a List widget, a
PopupMenu, or a row of PushButtons. In fact, these configurations are so common that Motif provides convenience
routines for creating them: XmCreateRadioBox() and XmCreateSimpleCheckBox(). RadioBoxes and
CheckBoxes are really specialized instances of the RowColumn manager widget that contain ToggleButton children.
12.3.1 Creating ToggleButtons
Applications that use ToggleButtons must include the header file <Xm/ToggleB.h>. ToggleButtons may be created
using XtVaCreateManagedWidget(), as in the following code fragment:
Widget toggle;
toggle = XtVaCreateManagedWidget ("name",
xmToggleButtonWidgetClass, parent,
resource−value−list,
NULL);
ToggleButtons are also available in the form of gadgets. To use a ToggleButton gadget, you must include the header
file <Xm/ToggleBG.h>. ToggleButton gadgets may be created using XtVaCreateManagedWidget() as follows:
Widget toggle;
toggle = XtVaCreateManagedWidget ("name",
xmToggleButtonGadgetClass, parent,
resource−value−list,
NULL);
As we'll show you later in this section, it is also possible to create ToggleButtons at the same time as you create their
RowColumn parent. This technique is commonly used when you create a RadioBox or a CheckBox.
the figure shows an example of several different ToggleButtons in various states.
12 Labels and Buttons 12.3.1 Creating ToggleButtons
319