>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