Occurs when the Idle function has been called in an application object script and the specified number of seconds have elapsed with no mouse or keyboard activity.
Event ID Objects
None (do not use a RETURN statement)
This statement in an application script causes the Idle event to be triggered after 300 seconds of inactivity:
In the Idle event itself, this statement closes the application:
Idle PowerScript function:
Sets a timer so that PowerBuilder triggers an Application Idle event when there has been no user activity for a specified number of seconds.
Idle ( n )
n The number of seconds of user inactivity allowed before PowerBuilder triggers an Application Idle event. A value of 0 terminates Idle detection.
Integer. Returns 1 if it starts the timer, and -1 if it cannot start the timer or n is 0 and the timer has not been started. Note that when the timer has been started and you change n, Idle does not start a new timer; it resets the current timer interval
to the new number of seconds. If n is NULL, Idle returns NULL. The return value is usually not used.
Use Idle to shut off or restart an application when there is no user activity. This is often done for security reasons.
Idle starts a timer after each user activity (such as, a keystroke or a mouse click), and after n seconds of inactivity it triggers an Idle event. The Idle event script for an application typically closes some windows, logs off the database, and exits the
application or calls the Restart function.
The timer is reset when any of the following activities occur:
<1>A mouse movement or mouse click in any window of the application
<2>Any keyboard activity when a window of the PowerBuilder application is current
<3>A mouse click or any mouse movement over the icon when a PowerBuilder application is minimized
<4>Any keyboard activity when the PowerBuilder application is minimized and is current (its name is highlighted)
<5>Any retrieval on a visible DataWindow that causes the edit control to be painted
Tip To capture movement, write script in the MouseMove or Key events of the window or sheet. (Keyboard activity does not trigger MouseMove events.) Disable the DataWindow control and tab ordering during iterative retrieves so the Idle timer is not reset.
his statement sends an Idle event after five minutes of inactivity:
This statement turns off idle detection:
This example shows how to use the Idle event to stop the application and restart it after two minutes of inactivity. This is often used for computers that provide information in a public place.
Include this statement in the script for the application's Open event:
Idle(120) // Sends an Idle event after 2 minutes.
Include these statements in the script for the application's Idle event to terminate the application and then restart it:
// Statements to set the database to the desired
Restart() // Restarts the application