Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>setcancel()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SETCANCEL()


Syntax:     SETCANCEL([<expL>])

Purpose:    To toggle program termination with Alt-C, on or off.

Argument:   <expL> toggles the termination capability on or off.
            Specifying true (.T.) toggles termination on and false (.F.)
            toggles it off.  The default setting when a Clipper
            application loads is true (.T.).

Returns:    A logical value.

            SETCANCEL() returns the current setting.

Usage:      SETCANCEL() serves two basic purposes:  toggling the state
            of the termination key, Alt-C, and reporting the current
            state of SETCANCEL().

            Note: SET KEY takes precedence over Alt-C when the
            termination state is enabled.

            Caution: When SETCANCEL() has been set false (.F.), you
            cannot terminate a run-away program unless you have provided
            an alternative escape mechanism.

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   This example demonstrates how to provide an escape route with
   SETCANCEL() set to false (.F.).  Note, however, that this method
   works only from within a wait state.

   SETCANCEL(.F.)             && Disable Alt-C as halt key.
   SET KEY 302 TO AltC        && Redefine Alt-C.

   <statements>...

   RETURN


   PROCEDURE AltC
   PRIVATE temp_scr, answer

   SAVE SCREEN TO temp_scr
   lastcolor = SETCOLOR("W/B, N/G")

   @ 6, 20 CLEAR TO 9, 58
   @ 6, 20 TO 9, 58 DOUBLE
   @ 7, 26 SAY "Alt-C: Do you want to quit?"
   @ 8, 35 PROMPT " Yes "
   @ 8, 41 PROMPT " No "
   MENU TO answer

   SET COLOR TO (lastcolor)
   RESTORE SCREEN FROM temp_scr

   IF answer = 1
      QUIT
   ENDIF

   RETURN


See Also: SET ESCAPE SET KEY ALTD()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson