Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stop process with a click on Cancel button
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Contracts, agreements and general business
Title:
Stop process with a click on Cancel button
Miscellaneous
Thread ID:
01671097
Message ID:
01671097
Views:
57
Hi,

I have a test loop in a form with a cancel button. I run the loop for 20 seconds and while it runs click on the Cancel button. But nothing happens (inside the Cancel button click I put the messagebox() for testing). Here is the code in my test loop:
nBegin = SECONDS()
DO WHILE .T.
	nEnd = SECONDS()
	IF nEnd - nBegin > 20
		EXIT
	ENDIF 
	toThisform.Draw
	DOEVENTS 
	IF tothisform.lExit  &&   lExit is set to .T. in the Cancel button click method 
		MESSAGEBOX("Clicked on Cancel button")
	ENDIF 
ENDDO 
What am I missing? TIA

Update. It appears that the value in _vfp.AutoYield is the key. The default is .F. And if I set it to .T., the loop can be interrupted.
Question: should I set it back to .F. in the form Unload?

TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Reply
Map
View

Click here to load this message in the networking platform