Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Timers and loops
Message
From
20/10/2000 13:47:39
 
 
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:
00432154
Views:
24
>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?

In any looping code or anything like that, I do this:
LOCAL obtn, ncnt, x
obtn = thisform.cmdStopButn
ncnt = 0
DO WHILE .t.
  x = SYS(1270)
  IF MDOWN() AND TYPE('x')='O' AND obtn.Name=x.Name
    thisform.StopMe = .t.
    DOEVENTS
  ENDIF
  IF thisform.StopMe
    EXIT
  ENDIF
  ncnt = ncnt + 1
  WAIT WINDOW NOWAIT 'Run Away '+TRANSFORM(ncnt,'')+'!!!!!'
ENDDO
Note that the cmdStopButn has in it's click method code to set the form property StopMe to .T.. The DOEVENTS lets the click from the button take effect (setting the StopMe property) and then the check bails out of the loop.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform