BEFORE DIALOG block
Syntax
BEFORE DIALOG
instruction [...]
Usage
The BEFORE DIALOG block is executed one time as the first trigger when the
DIALOG instruction starts, before the runtime system gives control to the user. You
can implement variable initialization and dialog configuration in this block.
Like all control blocks of the procedural DIALOG / END DIALOG instruction, the
BEFORE DIALOG block must appear after the sub-dialog definitions. For a detailed
description, see the procedural
DIALOG instruction syntax.
The fields are initialized with the default values, before the BEFORE
DIALOG code is executed. When an INPUT sub-dialog uses the WITHOUT
DEFAULTS option or when inserting/appending a new row in an INPUT ARRAY
sub-dialog, the default values are taken from the program variables bound to the fields. Otherwise
(with defaults), the DEFAULT
attributes of the form fields are used.
In the next code example, the BEFORE DIALOG block performs some dialog setup and
gives the focus to a specific field:
DIALOG
DISPLAY ARRAY ...
...
END DISPLAY
INPUT BY NAME ...
...
END INPUT
...
BEFORE DIALOG
CALL DIALOG.setActionActive("save",FALSE)
CALL DIALOG.setFieldActive("cust_status", is_admin())
IF cust_is_new() THEN
NEXT FIELD cust_name
END IF
...
END DIALOG
A DIALOG instruction can include no more than one BEFORE DIALOG
control block.