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()

Advertisements

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