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
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