SET ESCAPE

SET ESCAPE

Toggle Esc as a READ exit key

Syntax

      SET ESCAPE ON | off | <xlToggle>

Arguments

ON enables Esc as a READ exit key.

OFF disables Esc as a READ exit key.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Description

If SET ESCAPE is ON, Esc terminates the current READ. Any changes made to the current Get object are lost, and validation with RANGE or VALID is bypassed. When SET ESCAPE is OFF and the user presses Esc, the key press is ignored. With SET KEY, however, you can reassign Esc for special handling, regardless of the status of SET ESCAPE.

Seealso

READ, READEXIT(), SETCANCEL(), SET KEY, SETKEY()

ReadVar()

READVAR()

Return variable name of current GET or MENU

Syntax

      READVAR( [<cVarName>] ) --> cOldVarName

Arguments

<cVarName> is a new variable name to set.

Returns

READVAR() return the old variable name. If no variable previously was set, READVAR() return “”.

Description

READVAR() is set inside a READ or MENU TO command to hold the uppercase name of the GET / MENU TO variable, and re-set back to old value when those commands finished. You should not normally set a variable name but rather use it to retrieve the name of a GET variable when executing a VALID or WHEN clause, or during SET KEY execution and you are inside a READ or MENU TO.

Examples

      // display a menu, press F1 to view the MENU TO variable name
      CLS
      @ 1, 10 PROMPT "blood sucking insect that infect beds   "
      @ 2, 10 PROMPT "germ; virus infection                   "
      @ 3, 10 PROMPT "defect; snag; (source of) malfunctioning"
      @ 4, 10 PROMPT "small hidden microphone                 "
      @ 6, 10 SAY "(Press F1 for a hint)"
      SET KEY 28 TO ShowVar
      MENU TO What_Is_Bug

      PROCEDURE ShowVar
         Alert( ReadVar() )     // WHAT_IS_BUG in red ALERT() box

Compliance

READVAR() works exactly like CA-Cl*pper’s READKEY().

Note however, that the <cVarName> parameter is not documented and used internally by CA-Cl*pper.

Platforms

All

Files

Library is rtl

Seealso

@…GET, @…PROMPT, MENU TO, READ, SET KEY, __AtPrompt(), __MenuTo()

__XHelp()

Template

Function

Name

__XHelp()

Category

API

Subcategory

Internal

Oneliner

Determines whether a HELP() user defined function exists.

Syntax

      __XHelp() --> <xValue>

Arguments

None

Returns

This function returns aleatory values.

Description

This is an internal undocumented CA-Cl*pper function, which will try to call the user defined function HELP() if it is defined in the current application. This is the default SetKey() handler for the F1 key.

Compliance

C52U

Files

Library is core

__SetFunction()

Template

Function

Name

__SetFunction()

Category

API

Subcategory

Events

Oneliner

Assign a character string to a function key

Syntax

      __SetFunction( <nFunctionKey>,  [<cString>] ) --> NIL

Arguments

<nFunctionKey> is a number in the range 1..40 that represent the function key to be assigned.

<cString> is a character string to set. If <cString> is not specified, the function key is going to be set to NIL releasing by that any previous __SetFunction() or SetKey() for that function.

Returns

__SetFunction() always return NIL.

Description

__SetFunction() assign a character string with a function key, when this function key is pressed, the keyboard is stuffed with this character string.

__SetFunction() has the effect of clearing any SetKey() previously set to the same function number and vice versa.

      nFunctionKey    Key to be set
      ------------    -----------------------
         1 .. 12      F1 .. F12
        13 .. 20      Shift-F3 .. Shift-F10
        21 .. 30      Ctrl-F1 .. Ctrl-F10
        31 .. 40      Alt-F1 .. Alt-F10

SET FUNCTION command is preprocessed into __SetFunction() function during compile time.

Examples

      // Set F1 with a string
      CLS
      __SetFunction( 1,  "I Am Lazy" + Chr( 13 ) )
      cTest := Space( 20 )
      @ 10,  0 SAY "type something or F1 for lazy mode " GET cTest
      READ
      ? cTest

Compliance

Harbour use 11 and 12 to represent F11 and F12, while CA-Cl*pper use 11 and 12 to represent Shift-F1 and Shift-F2.

Platforms

All

Files

Library is core

Seealso

Inkey(), SetKey(), __Keyboard(), SET KEY

SP_SCROLLER

SCROLLER()

  Short:
  ------
  SCROLLER() Hotkey lookup tables with dbf storage

  Returns:
  --------
  nothing

  Syntax:
  -------
  SET KEY xxx TO SCROLLER

  Description:
  ------------
  Scroller is a hotkey lookup table engine.

  Scroller is data-driven , meaning it operates on data
  stored external to

  the EXE in SCROLLER.DBF.

  SCROLLER() is called via a SET KEY. When called, it
  receives the parameters <cProc> and <cVar> from Clipper, telling
  it the proc and variable the user was sitting on when he pressed
  the hotkey.

  The actual parameters rec'd are <cProc> (proc name),
  <cLine> (line #) and <cVar> (variable name) .<cLine> is ignored,
  but it is included as the 2nd parameter because it is passed by
  Clipper's setkey routines.

  SCROLLER() attempts to find a corresponding record in
  SCROLLER.DBF (which contains fields for proc name and variable).
  SCROLLER.DBF is a storage place for lookup definitions.

  If SCROLLER does not find a matching record, it
  simply closes SCROLLER.DBF and returns to the previous area. It
  then displays a 'lookup table not found' message.

  If SCROLLER finds a matching record, it loads the
  values into memory and closes SCROLLER.DBF. It then opens the
  DBF [and index] of the lookup dbf in the next available area. If
  it is unable to open the dbf, it displays an error message and
  goes back to the previously selected area.

  SCROLLER then draws a box, using the DESCRIPTION
  field as the title, initializes a 1 element array composed of
  the SSTRING (see structure)  expression and calls SMALLS() .

  While in the SMALLS(), first letter searches can be
  done if the dbf is indexed  with a character index. Pressing
  ENTER will KEYBOARD the expression in SRETURN (unless its
  empty), close up the current area and return to the old area.
  Pressing escape just closes things up and returns to the old
  area.

  The KEYBOARD then takes over, feeding the SRETURN
  expression into the keyboard and into the current GET or GETS.

  Examples:
  ---------
   EXTERNAL SCROLLER

   SET KEY -1 TO SCROLLER  && F2

  Notes:
  -------
  BIG NOTE:

  This is really for managing dynamic lookup tables
  that will change frequently as to lookup params. Because of this, it
  is quite complex in nature.

  If you know what the lookup is going to be, and it
  will not change between compiles, look at SMALLS(), SMALLKSET(),
  SMALLVALID() and SMALLWHEN() and use one of these as
  appropriate, instead of SCROLLER().

  Source:
  -------
  S_SCROLL.PRG

 

SP_SCMOD

SCMOD()

  Short:
  ------
  SCMOD() Maintains scroller.dbf - see scroller()

  Returns:
  --------
  nothing

  Syntax:
  -------
  SET KEY xxx to SCMOD

  Description:
  ------------
  SCMOD() is a tool for online building and modifying
  of the SCROLLER.DBF used for SCROLLER() lookup tables.

  When called by a SET KEY, it recieves the PROCEDURE
  and VARIABLE parameters from the calling PROCEDURE. It then
  determines if there exists a matching record in the SCROLLER.DBF.

  If so, the lookup definition may be modified.
  Otherwise, a new lookup definition may be created.

  Examples:
  ---------
   EXTERNAL SCMOD
   SET KEY -31 TO SCMOD  && ALT-F2

  Notes:
  -------
  Be sure to declare SCMOD external.

  SCMOD() will create SCROLLER.DBF if it doesn't exist.

  Source:
  -------
  S_SCMOD.PRG

 

SP_KBDESC

KBDESC()

  Short:
  ------
  KBDESC() Keyboards character 27 (escape) when key pressed

  Returns:
  --------
  Nothing

  Syntax:
  -------
  SET KEY xxx TO KBDESC

  Description:
  ------------
  Allows setting an alternate key to the ESCAPE key.
  ESCAPE normally means 'get me outta here', but sometimes is the
  key you need to indicate the user is done selecting or some
  such. This function allows setting another key (e.g. F10) to act
  as the ESCAPE key.

  Examples:
  ---------
   SET KEY -9 TO KBDESC

  Warnings:
  ----------
  Be sure to issue a   SET KEY xxx TO   command to
  un-map this function when done

  Notes:
  -------
  Declare as EXTERNAL i.e.

  EXTERNAL KBDESC

  Source:
  -------
  S_KBDESC.PRG

 

SP_HELPMOD

HELPMOD()

  Short:
  ------
  HELPMOD() Interactively build and modify help screens

  Returns:
  --------
  Nothing

  Syntax:
  -------
  SET KEY xxx TO HELPMOD

  Description:
  ------------
  HELPMOD() creates and modifies help screens for
  HELP() which are stored in HELP.DBF.

  HELPMOD() allows online creation and modification of
  the size, location and contents of the help screen for the
  current PROC,VARIABLE combination, and stores the results in
  HELP.DBF.

  HELPMOD() is intended to be used online, during
  program execution, by the developer/programmer. It can be
  removed after development.

  By setting a key xxx to this function, the current
  PROC and VARIABLE are passed to it when the key is pressed
  during the program.

  By comparing the PROC and VARIABLE parameters against
  entries in the HELP.DBF, HELPMOD() can then provide the
  appropriate help screen for modification, or, if no matching
  record is found, allow creation of a new help screen record.

  HELP.DBF is created if not present.

  Examples:
  ---------
   EXTERNAL HELPMOD

   SET KEY -30 TO HELPMOD  && alt-F1

  Notes:
  -------
  Will not be much use during ACHOICE or MENU TO

  Source:
  -------
  S_HELPM.PRG

 

SP_HELP

HELP()

  Short:
  ------
  HELP() Provides context sensitive popup help

  Returns:
  --------
  Nothing

  Syntax:
  -------
  SET KEY xxx TO HELP

  Description:
  ------------
  By setting a key xxx to this function, the current
  PROC and VARIABLE are passed to it when the key is pressed
  during the program.

  By comparing the PROC and VARIABLE parameters against
  entries in the HELP.DBF, HELP() can then provide the appropriate
  help screen for the user. If no matching record is found, HELP()
  displays a 'No Help Found' message to the user.

  HELP() works in conjunction with HELPMOD() which is
  used to create help screen records for the HELP.DBF. HELPMOD()
  allows online creation and modification of the size, location
  and contents of the help screen for the current PROC,VARIABLE
  combination.

  Examples:
  ---------
   EXTERNAL HELP

   SET KEY 28 to HELP

  Warnings:
  ----------
  The SET KEY that called this proc is still active
  inside the proc. You may wish to modify the proc to turn off/on
  the set key.

  i.e. if called with key 28 (F1)

  at start :  SET KEY 28 to
  at end:     SET KEY 28 to HELP

  Notes:
  -------
  Will not be much use during ACHOICE or MENU TO

  Source:
  -------
  S_HELP.PRG

 

C5_SET KEY

SET KEY
 Assign a procedure invocation to a key
------------------------------------------------------------------------------
 Syntax

     SET KEY <nInkeyCode> TO [<idProcedure>]

 Arguments

     <nInkeyCode> is the INKEY() value of the key that receives the
     assignment.

     TO <idProcedure> specifies the name of a procedure that executes
     when the user presses the assigned key.  If <idProcedure> is not
     specified, the current <nInkeyCode> definition is released.

 Description

     SET KEY is a keyboard command that allows a procedure to be executed
     from any wait state when a designated key is pressed.  A wait state is
     any mode that extracts keys from the keyboard except for INKEY().  These
     modes include ACHOICE(), DBEDIT(), MEMOEDIT(), ACCEPT, INPUT, READ and
     WAIT.  After a key is redefined, pressing it executes the specified
     procedure, passing three automatic parameters corresponding to
     PROCNAME(), PROCLINE(), and READVAR().  The procedure and variable
     parameters are character data type, while the line number is numeric
     data type.

     You may define a maximum of 32 keys at one time.  At startup, the system
     automatically defines the F1 key to execute Help.  If a procedure with
     this name is linked into the current program and it is visible, pressing
     F1 from a wait state invokes it.

     Note that SET KEY procedures should preserve the state of the
     application (i.e., screen appearance, current work area, etc.) and
     restore it before exiting.

     Warning!  In Clipper, SET FUNCTION is preprocessed into the SET
     KEY and KEYBOARD commands.  This means that SET FUNCTION has the effect
     of clearing any SET KEY for the same key number and vice versa.  This is
     incompatible with previous releases, which maintained separate lists of
     SET FUNCTION keys and SET KEY keys.

 Notes

     .  Precedence: SET KEY definitions take precedence over SET
        ESCAPE and SETCANCEL().

     .  CLEAR with a SET KEY procedure: Do not use CLEAR to clear the
        screen within a SET KEY procedure since it also CLEARs GETs and,
        therefore, terminates READ.  When you need to clear the screen, use
        CLEAR SCREEN or CLS instead.

     .  Terminating a READ from a SET KEY procedure: The following
        table illustrates several ways to terminate a READ from within a SET
        KEY procedure.

        Terminating a READ from a SET KEY Procedure
        ---------------------------------------------------------------------
        Command             Action
        ---------------------------------------------------------------------
        CLEAR GETS          Terminates READ without saving current GET
        BREAK               Terminates READ without saving current GET
        KEYBOARD Ctrl-W     Terminates READ and saves the current GET
        KEYBOARD Esc        Terminates READ without saving current GET
        ---------------------------------------------------------------------

 Examples

     .  This example uses SET KEY to invoke a procedure that presents
        a picklist of account identification numbers when the user presses F2
        while entering data into the account identification field:

        #include   "Inkey.ch"
        //
        SET KEY K_F2 TO ScrollAccounts
        USE Accounts NEW
        USE Invoices NEW
        @ 10, 10 GET Invoices->Id
        READ
        RETURN

        PROCEDURE ScrollAccounts( cProc, nLine, cVar )
           IF cVar = "ID"
              SAVE SCREEN
              Accounts->(DBEDIT(10, 10, 18, 40, {"Company"}))
              KEYBOARD CHR(K_CTRL_Y) + Accounts->Id + ;
                       CHR(K_HOME)
              RESTORE SCREEN
           ELSE
              TONE(100, 2)
           ENDIF
           RETURN

 Files   Library is CLIPPER.LIB, header file is Inkey.ch.

See Also: INKEY() KEYBOARD LASTKEY() PROCEDURE PROCLINE()