appevents OnIdle event
Return to Introduction  Previous page  Next page
Applies to
acAppEvents component.  

Declaration
type  
  TIdleEvent = procedure(Sender: TObject; var Done: Boolean) of object;  
 
property OnIdle: TIdleEvent;  

Description
The OnIdle event occurs when an application becomes idle.  
 
Write an OnIdle event handler to perform special processing when an application is idle. An application is idle when it is not processing code. For example, an application is idle when it is waiting for input from the user.  
 
The TIdleEvent type is the type of the OnIdle event. TIdleEvent has a Boolean parameter Done that is True by default. When Done is True, the Windows API WaitMessage function is called after OnIdle returns. WaitMessage yields control to other applications until a new message appears in the message queue of the application. When Done is False, the application does not yield control to other applications while it is not busy.  
 
OnIdle is called only once, as the application transitions into an idle state. It is not called continuously unless Done is set to False. Applications that set Done to False consume an inordinate amount of CPU time, which affects overall system performance.