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.
If multipleSelect is set to false (as is the default), meaning that only one item in the list can be selected, the variable bound to the ConsoleList contains the index of the selected item. If the first item is selected, the variable contains the number 1; if the fifth item is selected, the variable contains the number 5.
If multipleSelect is set to true, the variable contains a binary representation of the selected items. Each item in the list is assigned a multiple of two according to its position: the first item is 1, the second is 2, the third is 4, the fourth is 8, the fifth is 16, the sixth is 32, and so on. The value of the variable is the sum of the values of all the selected items. For example, if only the first item is selected, the variable contains 1. If the first and second items are selected, the variable contains 3, which is the sum of the values for the two selected items. If the second, fifth, and sixth items are selected, the variable contains 50, or 2+16+32.
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]
};
end
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.