Chapter 3: Motif


Motif is an extension of the X-windows window manager interface. It provides a visually pleasing interface and allows the programmer to easily generate user friendly features such as push buttons, scrolled text windows, and pop-up dialogs. This section presents a brief overview of using motif. These motif structures are used in all of the UNCERT modules and once you are comfortable with one module, the other modules will "feel" much the same.


The Application Window:

The application window is composed of six main components: the window 1) application area, 2) control button, 3) title and movement bar, 4), icon button, 5) maximize and minimize button, and 6) resizing bars and corners. These are each shown in Figure 3.1. The buttons and bars are activated by using the mouse pointer and pressing the left mouse button when the desired object is identified.

(3-1)Figure 3.1

The application area is simply where the program is displayed.

The control button, when activated, displays a menu of window control options. However, most of the options can be more easily controlled by methods discussed below. The one exception is the item "close." Sometimes a window can "lock-up" and the application in the window no longer responds to the user; by selecting the "close" menu option, X-windows destroys the window and terminates the application process. This is not the recommended way to quit an application, but is a reasonable approach when the application is no longer responding.

[top]


Pull-Down Menus:

Most of the programs in the UNCERT package are controlled by pull-down menus off the main menu bar. To activate a menu selection, point at the desired item on the menu bar and hold the left mouse button down. When the item is selected a pull-down menu will appear. While holding the mouse button down point to the desired item then release. Note that the currently selected item appears raised (Figure 3.2). If you change your mind and don't want to select any item, move the mouse point off all the menus and release. Some pull-down menu items have further options; these are identified by a small arrow to the right of the selection (i.e. "Type" in Figure 3.2). When the mouse selects such an item, another pull-down menu is displayed.

(3-2)Figure 3.2

It is also possible to use the menu largely without using the mouse, but instead using keyboard commands. By examining Figure 3.2, most menu items have one character underlined. The underlined character identifies the key stroke that will activate each selection. Items on the main menu bar are selected by holding the <ALT> key with the appropriate character, items from sub-menus are selected by typing the character only. For example, to select the GRIDZO file type, as shown in (Figure 3.2), the correct key stroke sequence is:

<ALT>F T G
For the rest of this manual, a menu naming convention will be used. For this example, the text would refer to the menu item as File:Type:GRIDZO.

Some sub-menu items also have "..." proceeding them. These indicate that a pop-up dialog window will be displayed after its selection.

[top]


Pop-up Dialogs:

The pop-up dialog is a temporary window created by the application and is used to gather information from, or deliver a message to the user. The general format of a dialog window is shown in Figure 3.3. In the dialog response area there may be a series of buttons, text, text fields, scrolled text, slider bars, toggles, and toggle menus (each to be discussed). Below the response area there will be one to four buttons (Figure 3.3 shows OK, Apply, and Cancel; Help is also a commonly used button). OK is used to accept all the values defined in the dialog response area and remove the dialog. Apply also accepts all the values defined in the dialog response area, but the pop-up dialog is not removed; this option is often used in graphics programs to visually check how the graphic is modified by the parameter modifications before the dialog is removed. Cancel removes the dialog, and tries to discard changes made to values in the dialog response area. If Apply has been pressed, modified values cannot be canceled. If a <RETURN> has been used in a text field, the value cannot be canceled. Also, once a slider bar has been moved, its value cannot be canceled.

(3-3)Figure 3.3

A simple dialog box may be composed simply of a message, and an OK button. Generally the message will inform the user that some other task must be performed before the desired selection can be performed, or that the application does not currently support that feature currently. After the user has read the message, pressing the OK button or hitting return will remove the message dialog.

[top]


Buttons:

Buttons are used to respond to a question, or request further information. As seen in Figure 3.3, OK, Apply, and Cancel are responding to an implied question for the dialog: "Are you done with the dialog and do you want the values saved?". If a Help button had been present, by pressing it the user would be indicating information was desired about options in the pop-up dialog. The format of buttons is show in Figure 3.4. Buttons contain a text description and appear raised when the are ready to be pushed. They appear recessed when they are pressed. Buttons may also be deactivated by the program. Often the function of a button is inappropriate because of how other program inputs have been defined. By deactivating the button the user cannot perform illegal operations and the user is not tempted to supply more information then required. A deactivated button looks like a normal button, but the text descriptor is faded (Figure 3.4c).

(3-4)Figure 3.4

[top]


Scrolled Text:

Scrolled text areas are used to display textual information (such as a file) or display a list of options the user can select from (such as a list of all the files in the current directory). Often there is more information available then can be presented in the area supplied; when this occurs scroll-bars are attached to the bottom and side of the text area (Figure 3.5).

(3-5)Figure 3.5

In the middle of the scroll-bar is a black button; at the ends are two

arrows. If the black button extends from arrow to arrow, all the text is visible with regard to that scroll-bar (the horizontal scroll-bar controls visible columns, the vertical scroll-bar controls visible rows or lines). To move the view area one line or column at a time, one presses the appropriate scroll-bar arrow with the mouse pointer. To page down one presses the grayed area immediately below the scroll-bar button. To page up one presses the grayed area immediately above the scroll-bar button. A similar logic applies to the horizontal scroll-bar. Text can also be scrolled by pressing the appropriate scroll- bar button, holding the mouse button, and dragging the button up and down (or left and right) as desired.

If the text field is a selection area, as with a file selection dialog (to be discussed below), to select the desired item, point at the appropriate line with the mouse pointer, and press the left mouse button. The selected item will become highlighted. Note: many programs will let one double-click with the mouse on the selected item to execute the dialogs function (e.g., in a file selection dialog double-clicking on a filename will highlight the selection and pass the filename back to the program for further processing).

[top]


Slider Bar:

A slider-bar is used to allow the user to select a value from a closed range of continuous values. For example, a user might want to select a view direction over a surface; because view directions vary from 0-360 degrees only, a slider-bar can be reasonably used to select a desired variable value. A typical scroll-bar is shown in Figure 3.6. A slider-bar has a title, a position indicator, and a slider button. To move the slider-bar, the slider-bar button is pressed and held with the left mouse button, and dragged to the desired position. It is also possible to press on the grayed area to either side of the slider-bar button. This will move the slider-bar button 1/10 of the total range of the slider-bar in the indicated direction (i.e. +/-36 degrees for the above example).

(3-6)Figure 3.6

Note that with slider-bars, the desired value is not always exactly attainable. Slider-bars are limited to 100 positions. This means that with the view directions mentioned above, the smallest angular step is 3.6 degrees.

[top]


Text Fields:

Text fields are used to enter new variable values. The format of a text field in show in Figure 3.7. It is composed of the variable name and a recessed text entry box. To enter a new value in the entry box, select the text field with the mouse button, erase the previous entry and type in the new entry. To enter the new value press <RETURN> when done, or press OK or Apply if the text field is part of a pop-up dialog box. To erase a previous entry, one can 1) position the insert cursor at the end of the current entry and backspace over the old entry, 2) quickly double-click with the left mouse button in the text field; this highlights the entire selection, and the next typed key will replace the highlighted selection, or 3) using the mouse, holding the left mouse button down, starting at one end of the selection, dragging the mouse over the rest of the selection will highlight it; the next typed key will replace the highlighted selection.

(3-7)Figure 3.7

[top]


Toggles:

Many program options are ON or OFF, TRUE or FALSE. Toggle buttons are vary useful for defining these variables or parameters. Two toggle buttons are shown in Figure 3.8, the top one is OFF/FALSE and appears raised. and the bottom button is ON/TRUE appearing recessed. To the right of the toggle is the description. Toggle buttons are always squares. The toggle is changed by pressing the toggle button.

(3-8)Figure 3.8

[top]


Toggle Menus:

For many variables, they must be set to one possible option, out of several possibilities (e.g. the line color can be 1) red, 2) blue, or 3) green). These variables are defined with a toggle menu. A toggle menu can have only one active selection at a time. An example toggle menu is shown on Figure 3.9. It has a menu title followed by a series of diamond shaped toggles, the active toggle or selection appearing recessed, the rest raised. To select a menu option press the toggle next to the desired description; that option will be activated, and the previous selection will be turned off.

(3-9)Figure 3.9

[top]


Option Menu Lists:

Very similar to the toggle menu and serving the same purpose is the Option Menu List. This button/menu allows the user to select one possible option, out of several possibilities. A option menu list can have only one active selection at a time and this is the default label button/menu Figure 3.10a. The alternate options are displayed by pressing on the button/menu. When the list is display (Figure 3.10b), an item is selected by clicking on it.

(3-10)Figure 3.10

[top]


Table of Contents
Previous Chapter
Beginning of this Chapter
Next Chapter