Motif Xm Widgets

Motif widgets are displayed on the Palette for all languages except Java and for all platforms. Initially, Motif widgets are grouped in the following folders:

· Primitives

XmToggleButton, XmPushButton, XmDrawnButton, XmArrowButton, XmLabel, XmSeparator, XmScrollBar, XmTextField, XmText, XmScrolledText, XmList, and XmScrolledList.

· Containers

XmMainWindow, XmScrolledWindow, XmPanedWindow, XmScale, XmForm, XmBulletinBoard, XmDrawingArea, XmRowColumn, 
XmRadioBox, and XmFrame.

· Menus

XmMenuBar, XmPulldownMenu, XmOptionMenu, 
and XmPopupMenu.

· Dialogs

XmSelectionBox, XmFileSelector, XmMessageBox, and XmCommand.

The following sections provide descriptions of each Motif widget in alphabetical order (refer to your Motif documentation for more detailed information).

Arrow Button


The XmArrowButton consists of a directional arrow surrounded by a border shadow. When the widget is selected, the shadow changes and the Arrow Button appears to be depressed. When the Arrow Button is unselected, the shadow changes and the Arrow Button appears to be released. Callbacks notify the application when an Arrow Button is activated.


Use for application actions such as moving up in a text editor or searching forward through the text buffer.

Bulletin Board


The XmBulletinBoard widget is a composite widget that provides simple geometry management for children. It does not force positioning on its children, but can be set to reject geometry requests that result in overlapping children. Bulletin Board is used as a general container widget.


· Use when your interface calls for exact positioning by specific location of the children objects.

· Positions children at the requested locations

· Can be set to move children out of its margins or so that they do not overlap one another

· Basis for Motif dialogs



The XmCommand widget is a special-purpose composite widget for command entry that provides a built-in command-history mechanism. Provides the user with a method for entering commands, while preserving a command history.


Includes the following:

· Command-line text-input field

· Command-line prompt

· Command-history list region

· Several auxiliary functions for better usability

Drawing Area


The XmDrawingArea widget is an empty container easily adaptable to a variety of purposes. Does no drawing and defines no behavior except for invoking callbacks. Callbacks notify the application when graphics must be drawn through exposure and widget resize events and when the widget receives input from the keyboard or mouse.


· Use when your interface calls for an area containing graphics that you control.

· May also accept children.

· Uses geometry management rules similar to that of the Bulletin Board.

Drawn Button


The XmDrawnButon widget consists of an empty window surrounded by a shadow border. It provides the application developer with a graphics area that can have Push Button input semantics. Callbacks notify the application when the widget is resized or receives an exposure event.


· Your application will be notified when it should draw particular graphics into the Drawn Button's window.

· Callbacks notify the application of exposure, resize, and so forth.



The XmFileSelector widget allows the user to select files from a hierarchy of directories and to traverse directories, viewing the files in these directories, and selecting files. The widget contains: a directory mask that includes a filter label and input field used to specify the directory; a scrollable list of directories; a scrollable list of filenames; a text input field; and push buttons for control.


Displays the following;

· Scrolled list of filenames

· Scrolled list of subdirectories

· Text input field for regular-expression matching

· Modifiable labels

· Several buttons for indicating the selection



The XmForm widget is a container that exerts strong control over its children's geometry. Constraints are placed on children of the Form to define attachments for each of the child's four sides. These attachments determine the layout behavior of the children when the Form resizes.


· Use for complex layouts in which children need to be placed with respect to one another.

· You can change the Form resources that specify the constraints on the children and how the children should be resized when the size of the Form changes.

· Nesting Forms within forms can help manage setting constraints.



The XmFrame widget is a simple manager used to enclose a single work area in a border. The Frame widget uses the Manager class resources for border drawing and performs geometry management. The Frame widget's size always matches its child's size plus the margins defined for it.Frame may also control a second "title" child that can be used for labeling the contents of the work area.


· Use to display an etched edge around a child, either with or without an attached label.

· Use this object to visually separate parts of the application's interface.



The XmLabel widget displays informational text or a pixmap image (which may optionally be surrounded by a margin).

Displays either text or pixmap and does not accept any button or keyboard input. Label widget receives enter and leave events and has a help callback.


· Text may be multi-line and multi-font.

· Does not respond to button or key input, and the text is not selectable.



The XmList widget allows the user to choose one or more items from a group of text choices. Items are selected from the list using both the mouse and the keyboard. The currently selected items are highlighted. Clicking on the selected item activates a callback which receives information about the selected item. Several convenience routines are available.


Supports several interface styles that allow single or multiple selections of the items.

Main Window


The XmMainWindow widget creates a main screen for an application that follows the Motif style guidelines.

Provides a Motif Style Guide compliant layout for the primary window of an application. This layout includes a Menu Bar, a Command window, a work region, a message window, and Scroll Bar widgets.


Manages the layout of a MenuBar, a command-entry area, a message area, a work region showing the main portion of the application, and scrollbars for displaying offscreen portions of the work region.

Menu Bar


The XmMenuBar widget provides a permanent location for cascade buttons associated with the menus that appear either underneath the cursor or when the keyboard is used to invoke the menu system.


· Use in conjunction with several Pulldown Menus to create a Motif pulldown menu system.

· Menu Bar is a RowColumn widget with a specific resources set.

Message Box


The XmMessageBox widget is a dialog class used for creating simple message dialogs. Convenience dialogs based on Message Box are provided for several common interaction tasks, which include giving information, asking questions, and reporting errors. A pixmap may be placed to the left of the message text to provide quick visual recognition of a familiar message.

The Template Dialog variant allows you to completely control the contents of the dialog (buttons, etc.) while maintaining compliance with the OSF/Motif Style Guide requirements on dialogs.


· Use for such tasks as reporting errors, supplying information, and asking simple questions.

· Contains the following a message symbol, message, and several buttons for indicating the response.

· Use the "dialogType" resource to change the display to the following:

Message Dialog (default)
Working Dialog
Question Dialog
Information Dialog
Error Dialog
Template Dialog

Option Menu


The XmOptionMenu widget provides the user with a choice of options from a list that is displayed.


· Displays the currently selected choice.

· Option Menu is a RowColumn widget with a specific resources set.

Paned Window


The XmPanedWindow widget allows the user to vertically resize various portions of the application interface.

Composite widget that lays out children in a vertically tiled format. The first child is inserted at the top of the Paned Window and each successive child is inserted below. The Paned Window grows to match the width of its widest child and all other children are forced to this width. The height of the Paned Window is equal to the sum of the heights of all its children, the spacing between them, and the size of the top and bottom margins.


Each child object that the Paned Window controls is associated with a sash which the user may move to change the size of the child.

Popup Menu


The XmPopupMenu widget creates a menu that provides the user with a set of choices or actions.


· Creates a menu that pops up dynamically.

· Popup Menu is a RowColumn widget with a specific resources set.

Pulldown Menu


The XmPulldownMenu widget creates a pulldown menu system.


· Use one or more Pulldown Menus as the children of a MenuBar.

· The children of the Pulldown Menus may be simple buttons, cascade menus, or label objects that display choices or actions for the user.

· Must be a child of Menu Bar.

· Builder Xcessory automatically creates a Pulldown Menu and cascade button.

Push Button


The XmPushButton widget issues commands within an application.

Consists of a text label or pixmap surrounded by a border shadow. When Push Button is selected, the widget appears as if it has been pressed in. When Push Button is unselected, it appears released.


· The visual capabilities are like those of the XmLabel.

· Typically displays a 3-D shadow, which gives it the raised appearance of a selectable object and which changes when selected to give the impression of being pressed in.

Radio Box


Use the XmRadioBox widget with several Toggle Button children to offer the user options presented by the Toggle Buttons.


· Allows the user to select from several options.

· Radio Box is a RowColumn widget with a specific resources set.

Row Column


The XmRowColumn widget is a general purpose manager capable of containing any widget type as a child. Generally does not require special knowledge of how its children function, and provides only support for several different layout styles. Can be configured as a Radio Box or one of four menu types, in which case, it expects only certain children. The four menu types are Menu Bar, Pulldown or Popup Menu Panes, and Option Menu.


· Supports several resources which specify the packing of the children.

· The Row Column is the basis for Motif menus and the Radio Box.



The XmScale widget allows the user to select a value within a range.


· Used by an application to indicate a value from within a range of values.

· Scale is a manager widget, and can accept children.

· Children are evenly spaced across the top of the scale.

Scroll Bar


The XmScrollBar widget allows the user to select a value within a range, such as a particular screen of text within a large file.

Allows the user to view an area that is too large to be displayed all at once. Scroll Bar widgets may be placed beside or within the widget that contains the data to be viewed. When the user interacts with the Scroll Bar, the area within the other widget scrolls.


· Displays two arrows for moving by a fixed increment.

· Displays a slider for moving by arbitrary amounts.

Scrolled List


Use the XmScrolledList widget when the amount of data you need to display is larger than the area of the application available.


The object is an XmList within an XmScrolledWindow. That is, when you select Scrolled List from the Palette, two widget instances are created: List (the widget you selected) and Window (the parent of Scrolled List).

Scrolled Text


Use the XmScrolledText widget when the amount of data you need to display is larger than the area of the application available.


The object is an XmText within an XmScrolledWindow. In other words, when you select Scrolled Text from the Palette, two widget instances are created: Text (widget you selected) and Window (parent of Scrolled Text).

Scrolled Window


The XmScrolledWindow widget allows the user to view a portion of a much larger area. XmScrolledWidget combines one or more Scroll Bar widgets and a viewing area to function as a visible window onto some other data display. The visible part of the window can be scrolled through the larger display by the use of Scroll Bar widgets. Scrolling can be automatic. The programmer may control scrolling by setting scrolling policy to user defined and using callbacks.


· Displays two ScrollBars which may be manipulated to move the area into view.

· May also be configured to permit the application to do the scrolling, which may be more efficient for some applications.

Selection Box


The XmSelectionBox widget is a general Dialog widget that allows the user to select one item from a list. A Selection Box includes a scrollable list, an editable text field for the selected item, labels for the list and text field, and three buttons for control. The user can select an item 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 to appear in the selection text edit area.


· Displays a scrolling list of items.

· Displays an editable text field for the selected item.

· Displays modifiable labels.

· Displays several buttons for indicating the selection.



The XmSeparator widget is a primitive widget that visually separates items in a display, that is, separates visually-distinct areas of your application's interface.


· Several different line drawing styles are provided in horizontal or vertical orientation.

· Supports several styles of line drawing which offer different etch or shadow effects.



The XmText widget is a single-line and multiline text editor. It can be used for single-line string entry, data entry into a form (with verification procedures), and full-window editing. Text provides the application with a consistent editing system for textual data. Keyboard actions are defined for primary selection, and cutting, pasting, insertion, and deletion of text.


· The user can edit text in-line.

· Text also supports Motif Drag and Drop.

Text Field


The XmTextField widget creates a single-line string entry area, and provides a single-line text entry field. It has many of the Text widget's resources with the exception of those relating to multiple line text editing. Callbacks notify the application of cursor movement and changes in the text or input focus.


· Use for single line text entry (more efficient than using a Text widget in single line mode).

· Text may be edited in-line by the user.

· Supports Motif Drag and Drop.

Toggle Button


The XmToggleButton widget allows the user to set an on/off choice, and sets state data within an application. This widget consists of text or a pixmap with an optional indicator.


· Visual capabilities are like those of the XmLabel.

· May display an indicator that shows the type of choice the user may make.

· Several Toggle Buttons may be grouped together in a Radio Box to support 1-of-N selection.