Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
READ TIMEOUT has incorrect timing
Message
 
To
27/03/2013 15:00:00
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01569181
Message ID:
01569372
Views:
76
>http://support.microsoft.com/kb/133451

That is not a good solution IMO, 1st, other objects will prevent the MouseMove (and if KeyPreview is .f. also the KeyPress) event to be fired if there are objects on the form, so you will need to BindEvents every object of the form, which is not mentioned in the article (and it did not exist in 2004 anyways :)

Furthermore, once you get to fire the events, then you do not need any extra properties or intervals or nothing, just setting up a timer with a timeout interval which once fired closes the form, and then reset the timer on movement, something like this:
loForm			= CreateObject('myForm')
loForm.Show(1)


define class myForm as Form
	KeyPreview = .f.
	
	add object myTimer as Timer with interval = 5000, enabled = .t.
*	add object myEditBox as EditBox with left = 0, top = 0, width = thisform.Width, height = thisform.Height
	
	procedure MouseMove(nButton, nShift, nXCoord, nYCoord)
		thisform.myTimer.Reset()
	endproc
	
	procedure KeyPress( tnKeyCode, tnShiftAltCtrl)
		thisform.myTimer.Reset()
	endproc
	
	procedure myTimer.Timer()
		thisform.Release()
	endproc

*	function Init()
*		BindEvent(thisform.myEditBox, 'MouseMove', thisform, 'MouseMove', 2 + 4)
*		thisform.KeyPreview = .t.
*		return .t.
*	endfunc

enddefine
Uncommenting the myEditBox shows the flaw I mentioned, uncommenting Init shows a possible solution (a true one would be to iterate thru all controls)
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform