Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Long Process Interruption
Message
From
19/01/2001 13:17:48
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Long Process Interruption
Miscellaneous
Thread ID:
00465868
Message ID:
00465868
Views:
46
I'm writing a complicated process program and am not sure how to implement a user interrupt mechanism.

This is a long process, so I have a form that will display status messages. After the needed setup, there's a READ EVENTS command. Then, the form has a "Start Process" button to get things going. Once started, the legend changes to "Cancel" and it's Cancel property set to .T. (so that Esc will activate it).

There is a global variable, bAborted, that the process code periodically checks so that it "knows" it must terminate. The Cancel button is set to change this to .T. When stepping thru the code, this works fine.

But, during normal running, it doesn't work; clicking the button and pressing Escape (SET ESCAPE is OFF) don't stop the process at all. Apparently, there's no time to service the button's Click() method as the process program is running at full tilt.

To solve this, I periodically issue an INKEY(1) command (and look for an Esc keypress that will also set the variable). This works. However, I can't help but think that there must be a better way to do this.

Can anyone offer suggestions?
Next
Reply
Map
View

Click here to load this message in the networking platform