Console UI

EGL maintains a Console UI technology to support the kinds of user interfaces found in Informix® 4GL. This technology displays information in one of three ways:
Curses mode
Displays using curses on a UNIX system. Using the mouse has no effect. Use this mode when connecting via telnet to a UNIX system or while using a terminal device (such as the classic VT100 or its emulators).
Swing mode
Displays text only on a Windows system. Using the mouse has no effect. Here EGL uses the Java™ Swing libraries to mimic the output of curses mode.
RCP mode
Displays on a local-type graphical user interface (GUI) on Windows, providing a simplified version of the rich client platform (RCP). Mouse operations, cut-and-paste, and other GUI standards are supported. This mode uses the open-source standard widget toolkit for Java (SWT) to provide controls such as buttons and combination boxes.

The program presents a console form and can respond immediately to a user event, as when the user presses the Tab key to move an on-screen cursor to the next field. Validation is on a field-by-field basis, and you can restrict the cursor to the current field until the user has typed valid data there.

Console UI is available only in EGL programs generated for Java. Console UI might be useful for programs that are not migrated from I4GL if you require a non-web interface.

When you use Console UI, you typically code a program in the following way:
  1. Declare a set of variables that are based on the Console UI parts (see "Binding variables in Console UI" in this topic), which are always available.
  2. Open a console form by including a Console UI variable as an argument when you invoke the appropriate EGL function. Alternatively, you can open a form (or other Console UI variable) by invoking an EGL function like displayFormByName(), which accepts a name that is known at run time.
  3. Reference the form in an EGL openUI statement. The openUI statement ties events such as user keystrokes to program logic.

EGL provides a set of parts specifically for Console UI; see Console UI parts. Various formatting aspects of the display are controlled by properties specific to these parts; for more information, see the related reference links.

One common method of displaying columns of information in a Console UI window involves using an ArrayDictionary part. For more information, see Using an array dictionary in Console UI.

The EGL Language Reference covers only the language aspects of Console UI. For a more detailed overview, including information about using Console UI in the workbench, refer to the EGL Programmer's Guide.

Binding variables in Console UI

Console UI can assign user input to a variable, but only if you have specified a binding, a correspondence between the input field and a primitive type variable. The EGL runtime performs the following actions:
  • Uses the variable value as the initial content of a displayed field.
  • Moves the user's input to that variable when the user leaves the field.

You can bind Console UI fields to variables at the time you declare the field (see ConsoleField) or you can bind them with the openUI statement when the program begins its interaction with the user (see openUI).

Using console UI in line mode

You can also use Console UI in line mode, where your code reads or writes only one line at a time. This mode is appropriate for batch processing; for example, you might create a UNIX cron job that performs administrative work that cannot be run in interactive mode, and that simply sends unformatted output to stdout without using a form.

Line mode has the following implications:
  • In the Eclipse workbench, the user interacts with the Console view.
  • In a program that was invoked with a command prompt, the user interacts with the command window.
  • In a program that runs in curses mode in UNIX, the user interacts with the window in which the UI is displayed, and the usual window-based interaction is suspended.

Compatibility

Table 1. Compatibility considerations for Console UI
Platform Issue
COBOL generation EGL does not support Console UI for COBOL generation.

Feedback