setDefaultInitializer()
is used to specify the default function
which will be used for combo box initialization each time the program
creates a new ui.ComboBox object. This class method needs the quoted name
of the function or a variable containing the function name as an argument:
CALL ui.ComboBox.SetDefaultInitializer("init_function")
The initializing function should use the ui.ComboBox object as the argument. The ui.ComboBox object needs to be declared by a DEFINE statement within this function. Each time an object of ui.Combobox class is initialized in the program, the initialization function is called and the new ui.Combobox object is passed to it as a parameter. Thus it is possible to alter the combo box contents even before the corresponding form was opened.
setDefaultInitializer()
method needs the function name specified in lower-case.Here is an example of how this method is applied:
CALL ui.ComboBox.setDefaultInitializer("init_func")
....
FUNCTION init_func(cbx)
DEFINE cbx ui.ComboBox
CALL cbx.clear()
CALL cbx.addItem(1,"Village")
CALL cbx.addItem(2,"Town")
CALL cbx.addItem(3,"City")
END FUNCTION