Form Initialization Callback
- Last UpdatedOct 27, 2022
- 1 minute read
The initialization callback of the form allows the form’s gadgets to be initialized every time it is shown to reflect the current state of the application and possibly to validate whether the form can be displayed in the current context.
The callback will usually be a reference to a form method or possibly an open callback where several forms share a Global initialization function. For further information, refer to PML Open Callbacks.
You can set the callback by assigning to the form's initcall member. This can be done with the INITCALL command:
INITCALL '!This.InitCallBack()'
or directly by
!!MyForm.initcall = 'This.InitCallBack()'
Note:
The form initialization callback must not attempt to display another form. You may
invoke an ALERT object but not otherwise seek any input from you.
If the callback discovers an error so serious that the form cannot be displayed it can abort the display of the form by returning an error. You can supply the text of an error message that is to be presented in an error alert in place of the form:
define method .initcallback()
:
return error 1 'You do not have write access to this database'
endmethod
If the initialization callback has already caused an alert to be raised then you can prevent the raising of a new error alert by using the NOALERT keyword:
define method .initcallback()
:
return error 1 NOALERT
endmethod