Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Process interruption
Message
From
27/06/2000 11:36:35
 
 
To
27/06/2000 10:14:44
Leonid Kizelshteyn
Boston Medical Software, Llc
Massachusetts, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00385037
Message ID:
00385118
Views:
19
>I've got an interesting problem. I have a form with multiple buttons to start different things. One of these buttons starts a very lengthy process, progress of which I can monitor on a form (using some common ActiveX controls such as ProgressBar). It all works fine, until I've got a request to make a "Pause" button to suspend that process. My first reaction was to create a "PAUSE" button and put "pause"-related code into Click event. It turns out that the system processed that event after the long process finishes.
>My question is - is it any common methods to pause long process invoked from the form?



I've never done this, but here's a thought: in you long process code, you'll have to put DoEvents() so that VFP can process the click on the pause button. I guess the long process goes through a loop, so that would be a nice place to put in the DoEvents().

Caveat: DoEvents() stops processing for about half a second each time or until an event occurs, so if nothing happens and you call DoEvents 1000 times, you'll have to wait 500 more seconds until your process finishes. In that case, I would recommend calling DoEvents() only once every 100 records.

Next, in the pause button I would set a variable/property, and in the long process I would do something like:
DO WHILE <i>var</i> = <i>pause value</i>
    DOEVENTS()
ENDDO
Hope this helps!
Sylvain Demers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform