ON DELETE block
Syntax
ON DELETE
instruction [...]
Usage
The ON DELETE
trigger can be used to enable row deletion during a
DISPLAY ARRAY
dialog. If this block is defined, the dialog will automatically
create the delete action. This action can be decorated, enabled and disabled as regular actions.
The action created for the ON DELETE
modification trigger is implicitley marked
as a ROWBOUND
action.
If the dialog defines an ON ACTION delete
interaction block and the ON
DELETE
block is used, the compiler will stop with error -8408.
When the user fires the delete action, the dialog executes the user code of the ON
DELETE
block.
arr_curr()
:DISPLAY ARRAY arr TO sr.*
...
ON DELETE
IF fgl_winQuestion("Delete",
"Do you want to delete this record?",
"yes", "no|yes", "help", 0) == "no"
THEN
LET int_flag = TRUE
END IF
...
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 current row is deleted from the program array, and theBEFORE ROW
block is executed for the next row in the list. - If the
int_flag
global variable isTRUE
orstatus
is different from zero, the current row is kept in the program array, and theBEFORE ROW
block is executed again for the current row.
The DISPLAY ARRAY
dialog always resets int_flag
to
FALSE
and status
to zero before executing the user code of the
ON DELETE
block.
ON DELETE
handler can be configured with action attributes by
adding an ATTRIBUTES()
clause, as with user-defined action
handlers: ON DELETE ATTRIBUTES(TEXT=%"custlist.delete", IMAGE="listdel")