Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time elapsed
Message
From
15/08/2001 00:06:19
 
 
To
13/08/2001 07:35:05
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00542912
Message ID:
00543883
Views:
12
>I have a form where want to count the elapsed time from last movement of mouse or last key press and then release the form or activate a messagebox if time have a value gived by me.


You can create a timer to do that, somethign like this:
PUBLIC oT
oT = CREATEOBJECT('mytimer')

DEFINE CLASS mytimer AS timer
	nRow = 0
	nCol = 0
	nLastKey = 0
	Interval = 5000

	PROCEDURE Init
		this.SetValues()
	ENDPROC 

	PROCEDURE timer
		IF this.nRow = MROW() and this.nCol = MCOL() and ;
			this.nLastKey = LASTKEY()
			MESSAGEBOX('No movement has been detected.')
		ELSE 
			this.SetValues()
		ENDIF 
	ENDPROC 

	PROCEDURE SetValues
		this.nRow = MROW()
		this.nCol = MCOL()
		this.nLastKey = LASTKEY()
	ENDPROC 
ENDDEFINE
If you leave your mouse and keyboard in the same state for 5 seconds (the Interval property) you get a messagebox() saying no movement has been made.
Previous
Reply
Map
View

Click here to load this message in the networking platform