Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stop processing
Message
From
27/09/2006 19:10:04
 
 
To
27/09/2006 11:31:06
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01157160
Message ID:
01157700
Views:
24
>>>>A form has a checkbox that says: "Stop processing".
>>>>
>>>>The form has timers that run code.
>>>>
>>>>The problem is that I can only get access to the checkbox (to check it) when there is a gap. That is when the code has stopped running and the next timer event has not yet started.
>>>>
>>>>I would like to be able to "Stop processing" at any time. Any thoughts on how this can be accomplished?
>>>
>>>A DOEVENTS at certain points in the timer code? It'll probably make it a tad slower, but should give the code a chance to process user input.
>>
>>Thanks for the tip on using DOEVENTS.
>>
>>I read up on this in Hackers and they have a tip on combining it with MDOWN(). I implemented this.
>>
>>It works OK in a test form with a loop (for kk = 1 to 10000), where one can test for it at every iteration. However, where there is a lot of code being run in the loop, it doesn't work that well, as there is not enough time for the DOEVENTS to register the user's mouse click.
>>
>>I guess I need to do it after every line of code.
>>
>>What do you think of using ON KEY LABEL to stop processing?
>
>Generally, all the worst :). OKL is a wild thing, it can interefere with your code in unpredictable ways. But it can be tamed. Combined with DoEvents (which would give your app some chance of registering the keypress) it might work.
>
>Try this: at the start of your code,
>_screen.addproperty("lStop", .f.)
>On Key Label "alt+s" _screen.lstop=.t.
>
>then in some places in your code, probably at the beginning of an outer loop, and after there was at least one DoEvents executed, check for _screen.lStop - and bail out if it's .t.
>
>Don't forget to remove the OKL on your way out.
>
>I'm not sure this'll work at all, it's been FPD2.6 last time I had a long process that I cared to break out of. And OKLs were just as nasty then :).

Thanks to all for suggestions. I am going with:

On Key Label "alt+s" _screen.lstop=.t.

for now.

Cyril
Previous
Reply
Map
View

Click here to load this message in the networking platform