ui.ComboBox.setDefaultInitializer

Define the default initializer for combobox form items.

Syntax

ui.ComboBox.setDefaultInitializer(
   funcname STRING )
  1. funcname is the name of the initialization function.

Usage

The ui.ComboBox.setDefaultInitializer() class method defines the default initialization function to be called each time a COMBOBOX form field is created when loading forms. Use this method if you want to define a global/default initialization function for all comboboxes of the program. For individual comboboxes, consider using the INITIALIZER form field attribute instead.

Tip: Consider defining the initialization function name in lowercase letters. The language syntax allows case-insensitive functions names, but to avoid mistakes, it is recommended to use a common naming convention with lowercase letters.

The function is called with the ui.ComboBox object as the parameter.

The combobox initialization functions are typically used to fill the drop down list with items.

Example

MAIN
    ...
    CALL ui.ComboBox.setDefaultInitializer("cb_init")
    ...
    OPEN FORM f1 FROM "customers"
    DISPLAY FORM f1 -- initialization function is called
    ...
END MAIN

FUNCTION cb_init(cb)
  DEFINE cb ui.ComboBox
  CALL cb.clear()
  CALL cb.addItem(0,"Undefined")
  ...
END FUNCTION