ui.ComboBox.forName
Search for a combobox in the current form.
Syntax
ui.ComboBox.forName(
name STRING )
RETURNS ui.ComboBox
- name is the name of
COMBOBOX
form item.
Usage
The
ui.ComboBox.forName()
class method searches for a
ui.ComboBox
object by form field name in the current form.Important: The form field name must be in lowercase letters. The language syntax allows case-insensitive form
field names, and the runtime system must reference fields in lowercase letters internally. Since the
form compiler converts field names to lowercase in the 42f file, the name must
be lowercase in this method call.
After loading a form with OPEN WINDOW WITH FORM
, use the class method to retrieve a
ui.ComboBox
object into a variable defined as a ui.ComboBox
.
DEFINE cb ui.ComboBox
LET cb = ui.ComboBox.forName("formonly.airport")
Verify the function has returned an object, as the form field may not exist.
IF cb IS NULL THEN
ERROR "Form field not found in current form"
EXIT PROGRAM
END IF
Once instantiated, the ui.ComboBox
object can be used,
for example to fill the items of the drop down list.
CALL cb.clear()
CALL cb.addItem(1,"Paris")
CALL cb.addItem(2,"London")
CALL cb.addItem(3,"Madrid")