[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SETCANCEL()
 Toggle Alt+C and Ctrl+Break as program termination keys
------------------------------------------------------------------------------
 Syntax

     SETCANCEL([<lToggle>]) --> lCurrentSetting

 Arguments

     <lToggle> changes the availability of Alt+C and Ctrl+Break as
     termination keys.  Specifying true (.T.) allows either of these keys to
     terminate an application and false (.F.) disables both keys.  The
     default is true (.T.).

 Returns

     SETCANCEL() returns the current setting as a logical value.

 Description

     SETCANCEL() is a keyboard function that toggles the state of the
     termination keys, Alt+C and Ctrl+Break, and reports the current state of
     SETCANCEL().  Use SETCANCEL() when you want to suppress a user's ability
     to terminate a program without using the specified method.

     Note that if Alt+C or Ctrl+Break is redefined with SET KEY, the SET KEY
     definition takes precedence even if SETCANCEL() returns true (.T.).

     Warning!  When SETCANCEL() has been set to false (.F.), the user
     cannot terminate a runaway program unless you provide an alternative
     escape mechanism.

 Examples

     .  This example provides an escape route from a wait state with
        SETCANCEL() set off:

        #define K_ALTC   302
        //
        SETCANCEL(.F.)              // Disable termination keys
        SET KEY K_ALTC TO AltC      // Redefine Alt-C
        .
        . <statements>
        .
        RETURN

        FUNCTION AltC
           LOCAL cScreen, nChoice, cLastColor := ;
                 SETCOLOR("W/B, N/G")
           //
           SAVE SCREEN TO cScreen
           @ 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 nChoice
           SETCOLOR(cLastColor)
           RESTORE SCREEN FROM cScreen
           //
           IF nChoice = 1
              QUIT
           ENDIF
           //
           RETURN NIL

 Files   Library is CLIPPER.LIB.


See Also: SET ESCAPE SET KEY SETKEY()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson