XmSelectionBox (3) Linux Manual Page
XmSelectionBox — The SelectionBox widget class
Synopsis
#include <Xm/SelectioB.h>
Description
SelectionBox is a general dialog widget that allows the user to select one item from a list. By default, a SelectionBox includes the following:
- •
- A scrolling list of alternatives
- •
- An editable text field for the selected alternative
- •
- Labels for the list and text field
- •
- Three or four buttons
The default button labels are OK, Cancel, and Help. By default an Apply button is also created; if the parent of the SelectionBox is a DialogShell, it is managed; otherwise it is unmanaged. Additional children may be added to the SelectionBox after creation. The first child is used as a work area. The value of XmNchildPlacement determines if the work area is placed above or below the Text area, or above or below the List area. Additional children are laid out in the following manner:
- Menubar
- The first menu bar child is placed at the top of the window. The
XmQTmenuSystemtrait is used to check that it is the first MenuBar child. - Buttons
- All
XmPushButtonwidgets or gadgets, and their subclasses are placed after theOKbutton in the order of their creation (this order is checked using theXmQTactivatabletrait). The layout direction of the buttons depends on theXmNlayoutDirectionresource.
The layout of additional children that are not in the above categories is undefined.
The user can select an item in two ways: by scrolling through the list and selecting the desired item or by entering the item name directly into the text edit area. Selecting an item from the list causes that item name to appear in the selection text edit area.
The user may select a new item as many times as desired. The item is not actually selected until the user presses the OK PushButton.
The default value for the XmBulletinBoard resource XmNcancelButton is the Cancel button, unless XmNdialogType is XmDIALOG_COMMAND, when the default is NULL. The default value for the XmBulletinBoard XmNdefaultButton resource is the OK button, unless XmNdialogType is XmDIALOG_COMMAND, when the default is NULL.
For SelectionBox and its subclasses, the default value for XmNinitialFocus is the text edit area.
The user can specify resources in a resource file for the automatically created widgets and gadgets of SelectionBox. The following list identifies the names of these widgets (or gadgets) and the associated SelectionBox areas:
- List Items Label
Items- List Items
ItemsList- Selection Label
Selection- Selection Text
TextorTextField- Selection Separator
Separator
SelectionBox uses the XmQTaccessTextual, XmQTactivatable, and XmQTmenuSystem traits.
Descendants
SelectionBox automatically creates the descendants shown in the following table. An application can use XtNameToWidget to gain access to the named descendant. In addition, a user or an application can use the named descendant when specifying resource values.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Classes
SelectionBox inherits behavior, resources, and traits from Core, Composite, Constraint, XmManager, and XmBulletinBoard.
The class pointer is xmSelectionBoxWidgetClass.
The class name is XmSelectionBox.
New Resources
The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XmNapplyCallback- Specifies the list of callbacks called when the user activates the
Applybutton. The callback reason isXmCR_APPLY. XmNapplyLabelString- Specifies the string label for the
Applybutton. The default for this resource depends on the locale. In the C locale the default isApply.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNcancelCallback- Specifies the list of callbacks called when the user activates the
Cancelbutton. The callback reason isXmCR_CANCEL. XmNcancelLabelString- Specifies the string label for the
Cancelbutton. The default for this resource depends on the locale. In the C locale the default isCancel.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNchildPlacement- Specifies the placement of the work area child. The possible values are
-
XmPLACE_ABOVE_SELECTION- Places the work area child above the Text area
XmPLACE_BELOW_SELECTION- Places the work area child below the Text area
XmPLACE_TOP- Places the work area child above the List area, and below a MenuBar, if one is present
-
XmNdialogType- Determines the set of SelectionBox children widgets that are created and managed at initialization. The possible values are
-
XmDIALOG_PROMPT- All standard children except the list and list label are created, and all except the
Applybutton are managed XmDIALOG_COMMAND- Only the list, the selection label, and the text field are created and managed
XmDIALOG_SELECTION- All standard children are created and managed
XmDIALOG_FILE_SELECTION- All standard children are created and managed
XmDIALOG_WORK_AREA- All standard children are created, and all except the
Applybutton are managed
- If the parent of the SelectionBox is a DialogShell, the default is
XmDIALOG_SELECTION; otherwise, the default isXmDIALOG_WORK_AREA.XmCreatePromptDialogandXmCreateSelectionDialogset and append this resource to the creation arglist supplied by the application. This resource cannot be modified after creation. -
XmNhelpLabelString- Specifies the string label for the
Helpbutton. The default for this resource depends on the locale. In the C locale the default isHelp.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNlistItems- Specifies the items in the SelectionBox list.
XtGetValuesfor this resource returns the list items themselves, not a copy of the list items. The application must not free the returned items. XmNlistItemCount- Specifies the number of items in the SelectionBox list. The value must not be negative.
XmNlistLabelString- Specifies the string label to appear above the SelectionBox list containing the selection items. The default for this resource depends on the locale. In the C locale the default is
ItemsunlessXmNdialogTypeisXmDIALOG_PROMPT; in this case the default is NULL.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNlistVisibleItemCount- Specifies the number of items displayed in the SelectionBox list. The value must be greater than 0 (zero) unless
XmNdialogTypeisXmDIALOG_PROMPT; in this case, the value is always 0. The default is dynamic based on the height of the list. XmNminimizeButtons- Sets the buttons to the width of the widest button and height of the tallest button if False. If True, button width and height are not modified.
XmNmustMatch- Specifies whether the selection widget should check if the user’s selection in the text edit field has an exact match in the SelectionBox list when the
OKbutton is activated. If the selection does not have an exact match, andXmNmustMatchis True, theXmNnoMatchCallbackcallbacks are called. If the selection does have an exact match or ifXmNmustMatchis False,XmNokCallbackcallbacks are called. XmNnoMatchCallback- Specifies the list of callbacks called when the user makes a selection from the text edit field that does not have an exact match with any of the items in the list box. The callback reason is
XmCR_NO_MATCH. Callbacks in this list are called only ifXmNmustMatchis true. XmNokCallback- Specifies the list of callbacks called when the user activates the
OKbutton. The callback reason isXmCR_OK. If the selection text does not match a list item, andXmNmustMatchis True, theXmNnoMatchCallbackcallbacks are called instead. XmNokLabelString- Specifies the string label for the
OKbutton. The default for this resource depends on the locale. In the C locale the default isOK.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNselectionLabelString- Specifies the string label for the selection text edit field. The default for this resource depends on the locale. In the C locale the default is
Selection.- Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
labelStringresources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used. - Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the
XmNtextAccelerators- Specifies translations added to the Text widget child of the SelectionBox. The default includes bindings for the up and down keys for auto selection of list items. This resource is ignored if
XmNacceleratorsis initialized to a nondefault value. XmNtextColumns- Specifies the number of columns in the Text widget. The value must be greater than 0 (zero).
XmNtextString- Specifies the text in the text edit selection field.
Inherited Resources
SelectionBox inherits behavior and resources from the superclasses in the following tables. For a complete description of each resource, refer to the reference page for that superclass.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Callback Information
A pointer to the following structure is passed to each callback:
typedef struct
{
int reason;
XEvent * event;
XmString value;
int length;
} XmSelectionBoxCallbackStruct;
- reason
- Indicates why the callback was invoked
- event
- Points to the
XEventthat triggered the callback - value
- Indicates the
XmStringvalue selected by the user from the SelectionBox list or entered into the SelectionBox text field - length
- Indicates the size in bytes of the
XmStringvalue This member is obsolete and exists for compatibility with earlier releases.
Translations
XmSelectionBox inherits translations from XmBulletinBoard.
Accelerators
The XmNtextAccelerators are added to the Text descendant of XmSelectionBox. The default accelerators are described in the following list.
The following key names are listed in the X standard key event translation table syntax. This format is the one used by Motif to specify the widget actions corresponding to a given key. A brief overview of the format is provided under VirtualBindings(3). For a complete description of the format, please refer to the X Toolkit Instrinsics Documentation.
:<Key><osfUp>:- SelectionBoxUpOrDown(
Previous) :<Key><osfDown>:- SelectionBoxUpOrDown(
Next) :<Key><osfBeginLine>:- SelectionBoxUpOrDown(
First) :<Key><osfEndLine>:- SelectionBoxUpOrDown(
Last) :<Key><osfRestore>:- SelectionBoxRestore()
s c ≈m ≈a<Key>space:- SelectionBoxRestore()
Action Routines
The XmSelectionBox action routines are
- SelectionBoxUpOrDown(
Previous|Next|First|Last): - When called with an argument of
Previous, or 0 (zero) for compatibility, selects the previous item in the list and replaces the text with that item.- When called with an argument of
Next, or 1 for compatibility, selects the next item in the list and replaces the text with that item.- When called with an argument of
First, or 2 for compatibility, selects the first item in the list and replaces the text with that item.- When called with an argument of
Last, or 3 for compatibility, selects the last item in the list and replaces the text with that item. - When called with an argument of
- SelectionBoxRestore():
- Replaces the text value with the list selection. If no item in the list is selected, clears the text.
Additional Behavior
The SelectionBox widget has the following additional behavior:
<Key><osfCancel>:- Calls the activate callbacks for the cancel button if it is sensitive. If no cancel button exists and the parent of the SelectionBox is a manager, passes the event to the parent.
<Key><osfActivate>:- Calls the activate callbacks for the button with the keyboard focus. If no button has the keyboard focus, calls the activate callbacks for the default button if it is sensitive. In a List widget or single-line Text widget, the List or Text action associated with
<Key><osfActivate>is called before the SelectionBox actions associated with<Key><osfActivate>. In a multiline Text widget, any<Key><osfActivate>event except<Key><osfEnter>calls the Text action associated with<Key><osfActivate>, then the SelectionBox actions associated with<Key><osfActivate>. If no button has the focus, no default button exists, and the parent of the SelectionBox is a manager, passes the event to the parent. <OK Button Activated>:- If
XmNmustMatchis True and the text does not match an item in the file list, calls theXmNnoMatchCallbackcallbacks with reasonXmCR_NO_MATCH. Otherwise, calls theXmNokCallbackcallbacks with reasonXmCR_OK. <Apply Button Activated>:- Calls the
XmNapplyCallbackcallbacks with reasonXmCR_APPLY. <Cancel Button Activated>:- Calls the
XmNcancelCallbackcallbacks with reasonXmCR_CANCEL. <Help Button Activated>:- Calls the
XmNhelpCallbackcallbacks with reasonXmCR_HELP. <MapWindow>:- Calls the callbacks for
XmNmapCallbackif the SelectionBox is a child of a Dialog shell. <UnmapWindow>:- Calls the callbacks for
XmNunmapCallbackif the SelectionBox is the child of a DialogShell.
Virtual Bindings
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(3).
Related
Composite(3), Constraint(3), Core(3), XmBulletinBoard(3), XmCreateSelectionBox(3), XmCreateSelectionDialog(3), XmCreatePromptDialog(3), XmManager(3), and XmSelectionBoxGetChild(3).
