Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Timers and loops
Message
From
20/10/2000 14:01:33
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
20/10/2000 11:53:13
Roger Valles
United Provider Services
Fort Worth, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00431853
Message ID:
00432164
Views:
31
I assume the timer has got timer events queued up by the thousands. I still think the answer lies in DOEVENTS. Forget the Timer for now. If you insert the DOEVENTS command judiciously in the long series of routines, this allows Windows to see if there are any clicks awaiting processing. If so, they are processed. So if you click on the Stop Button, you can say Stop to the routine.
Do work1
DOEVENTS
IF NOT ThisForm.Stop
   Do Work2
ENDIF
DOEVENTS
IF NOT ThisForm.Stop
   Do Work3
ENDIF
FOR X=1 TO 100
   DOEVENTS
   IF NOT ThisForm.Stop
      Do Work4
   ENDIF
ENDFOR
>Charlie,
>Thanks for your advice. I am really trying to get a command button to stop a long series of routines from finishing, similar to the 'Phone dialer' in Windows. I know that the 'Escape' key will stop code from running. I have created a form with two command buttons ('RUN' and 'STOP') and a timer. I have set the timer Interval to 1/1000 of a second and a Wait Window with a Timeout of 5 seconds in the timer event. While the Timer is firing I can not click on the 'STOP' button to interrupt the Wait Window (the Wait Window simulates code running). Any advice?
Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform