A menu is a widget that allows the user to make a choice among actions or states. When the menu is visible, the user makes a choice by activating a button in the menu, usually by pressing Btn1, osfSelect, or osfActivate on the button. Some buttons also have mnemonics that allow the user to activate them by pressing the mnemonic keys when the menu is visible. Buttons can also have accelerators, which activate the buttons whether or not the menu is visible.
Like any other widget, a menu must be controlled by some parent widget. However, some types of Motif menu may be shared by more than one widget. (Only one widget will be the parent, but the same menu can be accessed from any other widget on the menu's "post-from" list.)
Motif has four basic kinds of menu:
RowColumn is the widget that Motif uses as a menu. A RowColumn can also be a nonmenu WorkArea. One use for a WorkArea is to contain a set of ToggleButtons constituting a RadioBox or a CheckBox. When the user selects a ToggleButton, its state changes from on to off or from off to on. In a RadioBox, only one ToggleButton at a time can be on; in a CheckBox, more than one ToggleButton can be on.
RowColumn performs special geometry management to align and lay out its children in a variety of ways. An application can use a RowColumn WorkArea to take advantage of the RowColumn geometry management for a set of widgets. For details see Chapter 14.
In addition to menus, users can also select choices by interacting with a ComboBox or a SpinBox.
A ComboBox is a combination of a List child and a TextField child. This combination gives users two ways to select a choice. That is, the user can either click on a displayed item in the List or type the choice directly into the TextField.
A SpinBox displays a combination of arrows and one or more textual widgets (usually Labels and TextFields). The user makes selections by clicking on the arrows. The arrow clicking increments or decrements the values displayed in the textual widgets. For example, a SpinBox would be an excellent widget to use when the user needs to select a date. The user could click on SpinBox arrows to adjust month and day fields.