ui.Form.setDefaultInitializer

Define the default initializer for all forms.

Syntax

ui.Form.setDefaultInitializer(
   funcname STRING )
  1. funcname is the name of a function in the program.

Usage

Specify a default initialization function with the ui.Form.setDefaultInitializer() method, to implement global processing when a form is opened.

The method takes the name of the initialization function as a parameter.

Important: The initialization function name must be in lowercase letters. The language syntax allows case-insensitive functions names, but the runtime system must reference functions in lowercase letters internally.

When a form is loaded with OPEN FORM / DISPLAY FORM or with OPEN WINDOW ... WITH FORM, the initialization function will be called with a ui.Form object as a parameter.

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

FUNCTION form_init(f)
    DEFINE f ui.Form
    CALL f.loadToolBar("common_toolbar")
END FUNCTION