ui.ComboBox.forName

Search for a combobox in the current form.

Syntax

ui.ComboBox.forName(
   name STRING )
  RETURNING result ui.ComboBox
  1. 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.

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")