awaytimer TacAwayTimer component
Hierarchy Properties Methods Events
Return to Introduction  Previous page  Next page
Overview
The acAwayTimer component monitors user activity and increase its time counter when keyboard and mouse are inactive (user distracted from PC or goes away). Also it triggers special event when system is about to start the screensaver, or after some defined period of user inactivity.  

Advantages ?
You can execute some specific actions when user away from PC. For example, automatically save file, re-index the database etc. If you are writing Internet communication tool, you can switch the status of presence to "inactive" (Sleep/Away mode, like it does most Inernet Conferencing and Instant Messenger tools like ICQ, AOL, MSN or WinJabber), to inform user on the other side that user is temporary away.  

How does it works and how to use ?
When the Active property is True, the acAwayTimer checks the mouse movements and keyboard presses with time interval specified in MonitorInterval property (in milliseconds).  
 
When component does not detects any activity (user doesn't use mouse and keyboard for some time), it increases special time counter which can be used to determinate how much time user was inactive (temporary away from PC, went to smoke, have break for coffee etc). You can determinate the time of inactivity reading AwayTime property. This is read-only property, however if you want to reset the AwayTime property programmatically — use ResetAway method.  
 
If you want to perform some specific actions after some time of inactivity — specify required time period (in units of milliseconds) to SleepInterval property and write OnSleep event handler. To be notified when user became active again (for example to return "Away" status to previous) — write OnAwake even handler.  
 
Also, the acAwayTimer detects when the screen saver starts and become deactivated. To be notified about screen saver presence — write OnScreenSaverStart and OnScreenSaverEnd events.  

See also
acAccurateTimer and acCronJob components.