<<
I have a process that after creating temp tables I use the cursor code to run a
series of PDF files.
Sometimes things happen during the WHILE loop (printer jam, out of paper, or
code interruption) where the user needs to cancel the rest of the print job.
What code would I use to give this option?
>
This is pretty easy to do in RBWin. What you do is you add a CANCEL button to
the form.
Your loop looks like this:
SET VAR gCANCEL = 'N'
-- Set up loop cursors, etc.
WHILE Cond THEN
IF gCANCEL = 'Y' THEN
BREAK -- User hit Cancel button
ENDIF
-- Loop code goes here.
ENDW
-- Clean up loop cursors, etc.
And the ON CLICK EEP of your CANCEL button contains this code:
-- Signal loop that user wants to cancel
SET VAR gCANCEL = 'Y'
R:Base will accept the click and process it while the loop is running. The
click will set the variable to Y. In the next iteration of the loop, the loop
will see that the variable is now 'Y' and exit. If you have a lot of
time-consuming code inside the loop, you can include the check for gCANCEL =
'Y'
in more than one place (otherwise, the delay between clicking Cancel and the
loop stopping could be one entire cycle of the loop).
--
Larry