ON UPDATE block
The ON UPDATE
trigger can be used to enable row
modification during a DISPLAY ARRAY
dialog.
If this block is defined, the dialog will automatically create
the update action. This action can be decorated, enabled and disabled
as regular actions.
You typically configure the TABLE
container in
the form by defining the DOUBLECLICK
attribute
to "update", in order to trigger the update action when the
user double-clicks on a row.
If the dialog defines an ON ACTION update
interaction
block and the ON UPDATE
block is used, the
compiler will stop with error -8408.
When the user fires the update action, the dialog executes
the user code of the ON UPDATE
block.
INPUT
statement,
to let the end user modify the data of the current row. This
is typically done with an INPUT
binding explicitly
array fields to the screen record fields, with the WITHOUT
DEFAULTS
clause. The current row in the program array
is identified with arr_curr()
, and the current
screen line in the form is defined by scr_line()
:DISPLAY ARRAY arr TO sr.*
...
ON UPDATE
INPUT arr[arr_curr()].* WITHOUT DEFAULTS 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 current row as follows:
- If the
INT_FLAG
global variable isFALSE
andSTATUS
is zero, the modified values of the current row are kept in the program array. - If the
INT_FLAG
global variable isTRUE
orSTATUS
is different from zero, the old values of the current row are restored in the program array.
The DISPLAY ARRAY
dialog always resets INT_FLAG
to
FALSE
and STATUS
to zero
before executing the user code of the ON UPDATE
block.
ON UPDATE
handler can be configured with action attributes by
added an ATTRIBUTES()
clause, as with user-defined action
handlers: ON UPDATE ATTRIBUTES(TEXT=%"custlist.delete", IMAGE="listdel")