ON IDLE block
The ON IDLE seconds
clause defines a set of instructions that
must be executed after a given period of user inactivity. This interaction block can be
used, for example, to quit the dialog after the user has not interacted with the program
for a specified period of time.
Do not mix ON TIMER
and
ON IDLE
clauses.
As ON IDLE
can fire field input validation, it is therefore not recommended in
dialogs allowing input.
The parameter of ON IDLE
must be an integer literal or variable. If the
value is zero, the dialog timeout is disabled.
It is not recommended to use the
ON IDLE
trigger with a short timeout
period such as 1 or 2 seconds; The purpose of this trigger is to give the control back to the
program after a relatively long period of inactivity (10, 30 or 60 seconds). This is typically the
case when the end user leaves the workstation, or gets a phone call. The program can then execute
some code before the user gets the control
back.ON IDLE 30
IF ask_question(
"Do you want to reload information from the database?") THEN
-- Fetch data back from the db server
END IF
Important: The timeout value is taken into account when the dialog initializes its
internal data structures. If you use a program variable instead of an integer constant, any change
of the variable will have no effect if the variable is changed after the dialog has initialized. If
you want to change the value of the timeout variable, it must be done before the dialog
block.