Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I set up a cancel button to cleanly cancel a proc
Message
From
24/01/2000 02:52:58
Walter Meester
HoogkarspelNetherlands
 
 
To
23/01/2000 22:04:19
Robert Younis
V-Fox Programming & Consulting, Inc.
Miami, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00321518
Message ID:
00321553
Views:
28
Robert,

You can do this using DOEVENTS somewhere in your processing loop. set a property (e.g. THISFORM.lCancelProcess) to .T. when a the cancel command button is clicked, and check for this value in your processing loop. Example.
FOR nT = 1 TO n
   ....
   ....
   DOEVENTS
   IF THISFORM.lCancelProcess
        EXIT
   ENDIF
ENDFOR
Depending on the nNumberOfItemsToBeProcessed you may need a mechanism to execute the DOEVENTS less frequently (using a devider), because the doevents takes considerable amounts of time to execute. There is a workarround for the slow doevents written by davind frankenbach (if i'm correct). Yopu may find some more information in the files section.


Walter,

>How do I set up a cancel button to cleanly cancel a process?
>If I have a process button running code in a form, how do I put
>in a cancel button that stays active during the processing so
>that when the cancel button is clicked the processing is stop
>and some cleanup code is run?
>
>Thanks in advance, Robert.
Previous
Reply
Map
View

Click here to load this message in the networking platform