Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] Lazarus - How to detect if a user has been idle
Delphi, Lazarus, Free Pascal
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter
May 4, 2015 7:15 AM
In my application, I'd like do something when a user has been inactive/idle for a while - in this case, I want the application to actually lock and request a pincode or password to let the user back in again.
This kept me busy for quite a while, just to find out that there is a hidden gem in Lazarus Pascal that does it all ...
Simply use TIdleTime, set the proper Interval (in milliseconds) and set Enabled:=TRUE and AutoEnabled:=TRUE.
After the user (keyboard and mouse) has been idle for the given time then the OnTimer event will fire.
Note: I have the impression that it was not specifically designed for this purpose, but it works.