Similarly to the ON APPEND control block, the ON INSERT trigger can be used to enable row creation during a DISPLAY ARRAY dialog. If this block is defined, the dialog will automatically create the insert action. This action can be decorated, enabled and disabled as a regular action.
If the dialog defines an ON ACTION insert interaction block and the ON INSERT block is used, the compiler will stop with error -8408.
When the user fires the insert action, the dialog first execute the user code of the AFTER ROW block if defined. Then the new row is created: The insert action creates a new row before current row in the list. After creating the row, the dialog executes the user code of the ON INSERT block.
DISPLAY ARRAY arr TO sr.* ... ON INSERT INPUT arr[arr_curr()].* FROM sr[scr_line()].* ; ...
Pay attention to the semicolon ending the INPUT instruction, which is usually needed here to solve a language grammar conflict when nested dialog instructions are implemented.
After the user code is executed, the dialog gets the control back and processes the new row as follows:
The DISPLAY ARRAY dialog always resets INT_FLAG to FALSE and STATUS to zero before executing the user code of the ON INSERT block.
The insert action is disabled if the maximum number of rows is reached.
ON INSERT ATTRIBUTES(TEXT=%"custlist.delete", IMAGE="listdel")