User interface programming / Dialog programming basics |
Execute some code after a given number of seconds, when the user does not interact with the program.
If an interactive instruction has the control, the program waits for a user interaction like an action or field input. If the end user leaves the workstation, or switches to another application, the program cannot get the control and is frozen until the user comes back. You might want to execute some code, after a perio of inactivity, for example to refresh the displayed data by doing a new database query, or even after a long period, to terminate the program automatically.
DEFINE seconds SMALLINT LET seconds = 120 DISPLAY ARRAY ... ... ON IDLE seconds MESSAGE "Automatic data refresh..." -- Reload the array with a new database result set ...
Note that the parameter of the ON IDLE trigger can be a integer variable, but it will only be read when the dialog is started. Changing the variable during dialog execution will have no effect.
A value of zero of less of zero disables the timeout trigger.