KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Note: A simple client timeout technique
PRODUCT: 4D | VERSION: 6.0 | PLATFORM: Mac & Win
Published On: February 1, 1998
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

This tech note presents a simple way of automatically quitting a client that isn’t in use.

The code presented here relies on the ON EVENT CALL command, with which we can detect mouse clicks and key presses. We also use a process that runs regularly to check whether the ON EVENT CALL method has been called recently. If there has been no key press or mouse click since the process last ran, the process quits the client.

We employ a Boolean variable to mean ‘A key press or mouse click has not recently occurred’. The startup method and the ON EVENT CALL method set this variable to False. The process which runs regularly sets this variable to True if it wasn’t already True. If it was true, it must have been true since the process last ran, so there hasn’t been any user activity in this time and the process then quits the client.
This tech note presents a simple way of automatically quitting a client that isn’t in use.

The code presented here relies on the ON EVENT CALL command, with which we can detect mouse clicks and key presses. We also use a process that runs regularly to check whether the ON EVENT CALL method has been called recently. If there has been no key press or mouse click since the process last ran, the process quits the client.

We employ a Boolean variable to mean ‘A key press or mouse click has not recently occurred’. The startup method and the ON EVENT CALL method set this variable to False. The process which runs regularly sets this variable to True if it wasn’t already True. If it was true, it must have been true since the process last ran, so there hasn’t been any user activity in this time and the process then quits the client.


Tech Note