Console UI widgets
When you use Console UI in RCP mode (see Console UI) you can add controls to your display by means of widgets. Widgets are the basic elements in a graphical user interface, including buttons, radio buttons, check boxes, and combo boxes. EGL uses the Java™ standard widget toolbox (SWT) to provide these elements.
EGL treats these widgets like EGL parts. You declare variables
based on them, and each has associated properties. All widgets have
the following properties:
- name
- This is the name the Console UI program will use to recognize the widget.
- bounds
- This is an array of four integers specifying the location and size of the widget, in characters, as follows: [row, column, height, width].
The following widgets are available:
- ConsoleButton
- This creates what appears to be a raised area on the screen. When
the user clicks the button, it appears to be depressed; when the user
releases the click, the button returns to normal. A ConsoleButton
has the following additional property:
- text
- A STRING whose value will appear on the button.
- ConsoleCheckBox
- This creates a standard check box. When a blank check box is clicked,
the box displays an X or check mark (depending on the platform). When
a checked box is clicked, the box clears. A ConsoleCheckBox has the
following additional property:
- text
- A STRING whose value will appear on the button.
- ConsoleCombo
- This creates a standard combo box (also called a drop-down list).
When the user selects a value from the expanded box, the selected
value appears in the condensed form of the box. A ConsoleCheckBox
has the following additional property:
- items
- An array of STRINGs whose values will appear in the expanded box.
- ConsoleRadioGroup
- This creates a set of standard radio buttons. Only one radio button
can be selected at a time. When the user selects a value from the
set, the selected button appears as filled in and the other buttons
in the set are cleared. A ConsoleRadioGroup has the following additional
property:
- items
- An array of STRINGs whose values will appear next to the buttons.
- ConsoleList
- This creates a list box, which is a list of string values from
which the user can select one or more. A ConsoleList has the following
additional properties:
- items
- An array of STRINGs whose values will appear next to the buttons.
- multipleSelect
- A BOOLEAN that specifies whether the user can select more than one item in the list, usually by holding the CTRL key while selecting items.
Example
The following simplified console record includes one of each type
of widget.
Record ShowWidgets type ConsoleForm { formsize=[12,55] }
* ConsoleField { position=[2,5], value="First Name" };
firstName ConsoleField { name="firstName", position=[2,20],
fieldLen=15, value="", inputRequired=no };
* ConsoleField { position=[3,5], value="Last Name" };
lastName ConsoleField { name="lastName", position=[3,20],
fieldLen=8, value="", inputRequired=yes };
button1 consolebutton {
name = "button1", bounds = [5,5,1,15], text = "Submit"
};
box1 consolecheckbox {
name = "box1", bounds = [5,6,1,15], text = "Check Me!"
};
combo1 consolecombo {
name = "combo1", bounds = [7,5,1,15]
};
radio1 consoleradiogroup {
name = "radio1", bounds = [5,25,3,15]
};
list1 consoleList {
name = "list1", bounds = [10,25,3,15]
};
endIn the following excerpt, the console displays the selected element
of the combo box.
OnEvent(ConsoleCombo.SELECTION_CHANGED: "combo1")
writeStdOut(myForm.combo1.items[combo1var]);For more extensive code samples, see the topics dealing with Console UI widgets in the EGL Programmer's Guide.