Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stop form
Message
From
01/07/2002 19:18:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00672891
Message ID:
00674190
Views:
28
>Can we have one universal approach? E.g. I don't want to put multiple checks in the form's code.
>
>I have a Distribution form. This form runs several processes, I want to be able to stop them in any time.

I undestand that this is desirable, but I don't think a universal solution (like "SET ESCAPE ON") is possible, or practical. For instance, different cleanup code might have to be run, depending on where the user interrupts.

You might try a universal solution, with SET ESCAPE, or with a timer.

In my own code, I use the not-so-universal solution of having a function, User_Interrupt(), that checks for a certain key being pressed. Then, a typical scan loop might look as follows:
local llInterrupted
scan
  * Do some processing with the selected record
  if User_Interrupt()
    llInterrupted = .T.
    exit
  endif
endscan
if llInterrupted
  ...
endif
The function User_Interrupt itself is very simple; the main commands are a) inkey(), and b) clear typeahead.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform