ConsoleUI parts and related variables

When you work with consoleUI, you create the following kinds of variables, which are based on the related consoleUI parts:

The library ConsoleLib also includes system variables of type PresentationAttributes. The system variables control visual aspects of displayed output. To change aspects of your display, you can change those variables by setting the PresentationAttributes fields color, highlight, and intensity. For details on those fields, see PresentationAttributes fields in EGL consoleUI.

Window

A window is a rectangular area in which you can place other visual entities that are represented as variables.

When you display a window and no other windows are in effect, the new window is inside the screen window, which is a rectangle that has the basic characteristics of any window in the operating system. This is not the case in UNIX® when the Curses library is in use; there the display of a consoleUI window puts the existing terminal window into windowing mode.

Any additional window that you display appears in the content portion of the screen window, usually on top of the window that you already opened. A side-by-side presentation of windows is also possible.

When you declare a window, you can set various properties. Position, for example, is the location relative to the upper left corner of the display; and size is the window's height and width in number of characters. You may use variables as well as literal values to specify both size and position.

An example of a window declaration is as follows:
myWindow WINDOW 
{name="myWindow", position = [2,2],
 size = [18,75], color = red, hasborder=yes};

You display a window by using an EGL function whose name begins with ConsoleLib.openWindow. If you have not displayed a window when presenting other data, EGL provides a window for you.

Prompt

A prompt is a one-line statement that elicits user input. A declaration of a prompt is as follows:
  myPrompt Prompt { message = "Type your ID: "}; 

You display a prompt by including the variable in an openUI statement, which binds the prompt to a variable of type String, but only for input. You can configure the prompt to accept a single character or a string.

ConsoleField

A consoleField is an on-screen field that is declared in the context of a console form (as described later). The next example declares a consoleField whose content can vary at run time:
  myField ConsoleField (
    name="myFieldName",
    position=[1,31],
    fieldLen=20, 
    binding = "myVariable" );
To specify constant text, use an asterisk (*) in place of the variable name, as in the following example:
  *    ConsoleField  
       { position=[2,5], value="Title:  " };

It is highly recommended that when you declare a named consoleField, you use the same name for the consoleField and for the value of the name attribute within the consoleField. However, different names are valid for those two uses. You would reference the consoleField name (like myField) when access to the consoleField is resolved at generation time. You would reference the name-attribute value (like myFieldName) when access is resolved at run time, as when the consoleField is used to define an event in the openUI statement.

ConsoleForm

A consoleForm is primarily a set of consoleFields. To make a consoleForm active, you invoke the system function ConsoleLib.displayForm. To display a read-only consoleForm, for example, you can do as follows:
  1. Invoke ConsoleLib.displayForm
  2. Invoke the system function ConsoleLib.getKey to wait for a user keystroke
To allow the user to write to a consoleField, do this instead:
  1. Invoke ConsoleLib.displayForm
  2. Issue an openUI statement that references either the displayed consoleForm or specific consoleFields in the consoleForm.

The consoleForm is a record of subtype ConsoleForm and can include not only consoleFields, but any of the fields that are valid in any EGL record.

To allow for user interaction with an on-screen table of consoleFields, do this:
  1. In the consoleForm, declare an arrayDictionary that in turn references consoleField arrays that are also declared in the consoleForm
  2. Use that arrayDictionary in an openUI statement

To allow for user interaction with only a subset of consoleFields in the consoleForm, you can list the consoleFields in the openUI statement, either in explicitly or by referencing a dictionary. Like the arrayDictionary, the dictionary is declared in the consoleForm and references consoleFields that are also declared in the consoleForm.

EGL does not display any primitive variable that you declare in the consoleForm. You can use such a variable to bind a consoleField, as you can use a variable declared outside of the consoleForm.

In general, you create consoleForm bindings in either of two ways:
  • By setting a default binding when you declare the consoleForm.
  • By setting a binding when you code the openUI statement.

Any binding specified in the openUI statement overrides the default binding in total; none of the consoleForm-declaration bindings remain.

If you use the openUI statement to bind variables, one option is to use the statement property isConstruct, which acts as follows:
  • Formats user input into a string appropriate to an SQL WHERE clause
  • Places that string into a single variable so you can easily code an SQL SELECT statement that retrieves user-requested data from a relational database, as when you code an EGL prepare statement

For details on the property isConstruct, see OpenUI statement.

Tab order is the order in which the user tabs from one consoleField to another. By default, the tab order is the order of the consoleFields in the consoleForm declaration. If you provide a list of consoleFields in an openUI statement, the tab order is the order of consoleFields in that statement; similarly, if you provide a dictionary or arrayDictionary in an openUI statement, the tab order is the order of consoleFields in the declaration of the dictionary or arrayDictionary.

By default, the user exits a consoleForm-related openUI statement by pressing the Esc key.

Menu

A menu is a set of labels displayed horizontally. One label is for the menu as a whole and one for each menuItem in the menu. To ensure that a response occurs when the user selects a particular menuItem, you reference the menu as a whole in the openUI statement and reference the menuItem in an OnEvent clause of that statement.

MenuItem

A menuItem displays a label and is used as described in the previous section.

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.