Foundation > Events > Idle Procedures
 
Idle Procedures
An idle procedure is a function provided by the application and called by the event loop at times when the application would otherwise be idle, waiting for events. Idle procedures must perform short computations; if an idle procedure is too long, it can affect the interactive response of the application.
Idle procedures are useful to perform tasks that do not need to be done before other tasks can continue. Their immediate completion should not be crucial to the application. For instance, idle procedures can be used to create hidden dialog boxes before they are requested by user actions.
When an idle procedure returns IlTrue, it is automatically removed and will not be called again. If it returns IlFalse, it is called each time the application is idle, until it returns IlTrue or it is explicitly removed by the application.
To register and unregister idle procedures, the application uses the IlvEventLoop methods addIdleProc and removeIdleProc. The returned value of addIdleProc is an ID that can be used for explicitly removing an idle procedure by calling removeIdleProc. Generally, idle procedures do not need to be removed; they return IlTrue instead.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.