The SelectionBox widget class
Format
#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:
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:
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:
SelectionBox uses the XmQTaccessTextual, XmQTactivatable, and XmQTmenuSystem traits.
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.
Named Descendant | Class | Identity |
= | ||
Apply | XmPushButtonGadget | Apply button |
Cancel | XmPushButtonGadget | Cancel button |
Help | XmPushButtonGadget | Help button |
Items | XmLabelGadget | title above the list of items |
ItemsList | XmList | list of items from which the user will select |
ItemsListSW | XmScrolledWindow | ScrolledWindow parent of ItemsList |
OK | XmPushButtonGadget | OK button |
Selection | XmLabelGadget | title above the selection box |
Separator | XmSeparatorGadget | dividing line between selection box and buttons |
Text | XmTextField | selection box containing text of selected item |
SelectionBox inherits behavior, resources, and traits from Core, Composite, Constraint, XmManager, and XmBulletinBoard.
The class pointer is xmSelectionBoxWidgetClass.
The class name is XmSelectionBox.
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).
XmSelectionBox Resource Set | ||||
Name | Class | Type | Default | Access |
XmNapplyCallback | XmCCallback | XtCallbackList | NULL | C |
XmNapplyLabelString | XmCApplyLabelString | XmString | dynamic | CSG |
XmNcancelCallback | XmCCallback | XtCallbackList | NULL | C |
XmNcancelLabelString | XmCCancelLabelString | XmString | dynamic | CSG |
XmNchildPlacement | XmCChildPlacement | unsigned char | XmPLACE_ABOVE_SELECTION | CSG |
XmNdialogType | XmCDialogType | unsigned char | dynamic | CG |
XmNhelpLabelString | XmCHelpLabelString | XmString | dynamic | CSG |
XmNlistItemCount | XmCItemCount | int | 0 | CSG |
XmNlistItems | XmCItems | XmStringTable | NULL | CSG |
XmNlistLabelString | XmCListLabelString | XmString | dynamic | CSG |
XmNlistVisibleItemCount | XmCVisibleItemCount | int | dynamic | CSG |
XmNminimizeButtons | XmCMinimizeButtons | Boolean | False | CSG |
XmNmustMatch | XmCMustMatch | Boolean | False | CSG |
XmNnoMatchCallback | XmCCallback | XtCallbackList | NULL | C |
XmNokCallback | XmCCallback | XtCallbackList | NULL | C |
XmNokLabelString | XmCOkLabelString | XmString | dynamic | CSG |
XmNselectionLabelString | XmCSelectionLabelString | XmString | dynamic | CSG |
XmNtextAccelerators | XmCTextAccelerators | XtAccelerators | default | C |
XmNtextColumns | XmCColumns | short | dynamic | CSG |
XmNtextString | XmCTextString | XmString | "" | CSG |
Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the labelString resources 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 labelString resources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used.
If the parent of the SelectionBox is a DialogShell, the default is XmDIALOG_SELECTION; otherwise, the default is XmDIALOG_WORK_AREA. XmCreatePromptDialog and XmCreateSelectionDialog set and append this resource to the creation arglist supplied by the application. This resource cannot be modified after creation.
Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the labelString resources 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 labelString resources 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 labelString resources 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 labelString resources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used.
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.
XmBulletinBoard Resource Set | ||||
Name | Class | Type | Default | Access |
XmNallowOverlap | XmCAllowOverlap | Boolean | True | CSG |
XmNautoUnmanage | XmCAutoUnmanage | Boolean | True | CG |
XmNbuttonFontList | XmCButtonFontList | XmFontList | dynamic | CSG |
XmNbuttonRenderTable | XmCButtonRenderTable | XmRenderTable | dynamic | CSG |
XmNcancelButton | XmCWidget | Widget | dynamic | SG |
XmNdefaultButton | XmCWidget | Widget | dynamic | SG |
XmNdefaultPosition | XmCDefaultPosition | Boolean | True | CSG |
XmNdialogStyle | XmCDialogStyle | unsigned char | dynamic | CSG |
XmNdialogTitle | XmCDialogTitle | XmString | NULL | CSG |
XmNfocusCallback | XmCCallback | XtCallbackList | NULL | C |
XmNlabelFontList | XmCLabelFontList | XmFontList | dynamic | CSG |
XmNlabelRenderTable | XmCLabelRenderTable | XmRenderTable | dynamic | CSG |
XmNmapCallback | XmCCallback | XtCallbackList | NULL | C |
XmNmarginHeight | XmCMarginHeight | Dimension | 10 | CSG |
XmNmarginWidth | XmCMarginWidth | Dimension | 10 | CSG |
XmNnoResize | XmCNoResize | Boolean | False | CSG |
XmNresizePolicy | XmCResizePolicy | unsigned char | XmRESIZE_ANY | CSG |
XmNshadowType | XmCShadowType | unsigned char | XmSHADOW_OUT | CSG |
XmNtextFontList | XmCTextFontList | XmFontList | dynamic | CSG |
XmNtextRenderTable | XmCTextRenderTable | XmRenderTable | dynamic | CSG |
XmNtextTranslations | XmCTranslations | XtTranslations | NULL | C |
XmNunmapCallback | XmCCallback | XtCallbackList | NULL | C |
XmManager Resource Set | ||||
Name | Class | Type | Default | Access |
XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNforeground | XmCForeground | Pixel | dynamic | CSG |
XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
XmNinitialFocus | XmCInitialFocus | Widget | dynamic | CSG |
XmNlayoutDirection | XmCLayoutDirection | XmDirection | dynamic | CG |
XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG |
XmNpopupHandlerCallback | XmCCallback | XtCallbackList | NULL | C |
XmNshadowThickness | XmCShadowThickness | Dimension | dynamic | CSG |
XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG |
XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG |
XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
XmNuserData | XmCUserData | XtPointer | NULL | CSG |
Composite Resource Set | ||||
Name | Class | Type | Default | Access |
XmNchildren | XmCReadOnly | WidgetList | NULL | G |
XmNinsertPosition | XmCInsertPosition | XtOrderProc | NULL | CSG |
XmNnumChildren | XmCReadOnly | Cardinal | 0 | G |
Core Resource Set | ||||
Name | Class | Type | Default | Access |
XmNaccelerators | XmCAccelerators | XtAccelerators | dynamic | N/A |
XmNancestorSensitive | XmCSensitive | Boolean | dynamic | G |
XmNbackground | XmCBackground | Pixel | dynamic | CSG |
XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNborderColor | XmCBorderColor | Pixel | XtDefaultForeground | CSG |
XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG |
XmNcolormap | XmCColormap | Colormap | dynamic | CG |
XmNdepth | XmCDepth | int | dynamic | CG |
XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
XmNheight | XmCHeight | Dimension | dynamic | CSG |
XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean | True | C |
XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG |
XmNscreen | XmCScreen | Screen * | dynamic | CG |
XmNsensitive | XmCSensitive | Boolean | True | CSG |
XmNtranslations | XmCTranslations | XtTranslations | dynamic | CSG |
XmNwidth | XmCWidth | Dimension | dynamic | CSG |
XmNx | XmCPosition | Position | 0 | CSG |
XmNy | XmCPosition | Position | 0 | CSG |
A pointer to the following structure is passed to each callback:
typedef struct { int reason; XEvent * event; XmString value; int length; } XmSelectionBoxCallbackStruct;
XmSelectionBox inherits translations from XmBulletinBoard.
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.
The XmSelectionBox action routines are
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.
The SelectionBox widget has the following additional behavior:
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).