DEFER INTERRUPT and the INT_FLAG
If the user selects Cancel during the
CONSTRUCT
, the built-in global integer variable INT_FLAG
is
automatically set to TRUE
.
INT_FLAG
is set to TRUE
, your program must reset
it to FALSE
to detect a new cancellation. You typically set
INT_FLAG
to FALSE
before you start a dialog instruction, and you
test it just after (or in the AFTER CONSTRUCT
/ AFTER INPUT
block)
to detect if the dialog was
canceled:LET INT_FLAG = FALSE
CONSTRUCT BY NAME where_part
...
END CONSTRUCT
IF INT_FLAG = TRUE THEN
...
END IF
The statement DEFER INTERRUPT
in your MAIN
program
block will prevent your program from terminating abruptly if a SIGINT
signal is received. When using a GUI interface, the user can generate an interrupt
signal if you have an action view named 'interrupt' (the predefined interrupt action).
If an interrupt event is received, TRUE
is assigned to
INT_FLAG
.
It is up to the programmer to manage the interruption event (stop or continue with the
program), by testing the value of INT_FLAG
variable.
Interruption handling is discussed in the report example, in Tutorial Chapter 9: Reports.