The following steps describe how to use the DISPLAY
ARRAY statement:
Create a form specification file containing a screen array.
The screen array identifies the presentation elements to be used by
the runtime system to display the rows.
Make sure that the program controls interruption handling
with DEFER INTERRUPT, to manage the validation/cancellation
of the interactive dialog.
Define an array of records with the DEFINE instruction.
The members of the program array must correspond to the elements of
the screen array, by number and data types. Static or a dynamic arrays
can be used for the full list mode, but the paged mode requires a
dynamic array. For new developments, use dynamic arrays in both cases.
Open and display the form, using OPEN WINDOW WITH
FORM or the OPEN FORM / DISPLAY
FORM instructions.
If you want to use the full list mode, fill the program
array with data, typically with a result set cursor, counting the
number of program records being filled with retrieved data.
Set the INT_FLAG variable to FALSE.
Write the DISPLAY ARRAY statement block.
When using a static array, specify the number of rows with the COUNT attribute
in the ATTRIBUTES clause, or call the SET_COUNT() function
before the dialog block. With dynamic arrays, the number of rows is
automatically known by the dialog. Consider using the UNBUFFERED mode
in new developments.
If you want to use the paged mode, define the total number
of rows with the COUNT attribute (can be -1 for infinite
number of rows), and add the ON FILL BUFFER clause
that will contain the code to fill the dynamic array with the expected
rows from fgl_dialog_getBufferStart() to fgl_dialog_getBufferLength().
If multi-row selection is needed, call the ui.Dialog.setSelectionMode() method
in BEFORE DISPLAY to enable this mode.
Inside the DISPLAY ARRAY block, control
the behvior of the instruction with BEFORE ROW, AFTER
ROW and ON ACTION blocks.
After the interaction statement block, test the INT_FLAG predefined
variable to check if the dialog was canceled (INT_FLAG=TRUE)
or validated (INT_FLAG=FALSE). If the INT_FLAG variable
is TRUE, reset it to FALSE to not
disturb code that relies on this variable to detect interruption events
from the GUI front-end or TUI console.
If needed, get the current row with the ARR_CURR() built-in
function after dialog execution. During dialog execution, you can
also use DIALOG.getCurrentRow().