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

Harbour All Functions – S

SaveToken

SayScreen

Seconds
Secs

Select

Set

SetAtLike

SetDate

SetKey

SetMode

SetPrec

SetTime

SetTypeahead

Sign

Sin

SinH

Space

Sqrt

Str

StrDiff

StrFormat

StrSwap
StrTran
StrZero
SubStr

SET FUNCTION

SET FUNCTION

Assign a character string to a function key

Syntax

      SET FUNCTION <nFunctionKey> TO [<cString>]

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 Set Function or SetKey() for that function.

Description

Set Function assign a character string with a function key, when this function key is pressed, the keyboard is stuffed with this character string. Set Function 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
      SET FUNCTION 1 TO "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

Seealso

Inkey(), SetKey(), __Keyboard()

hb_SetKeyGet()

HB_SetKeyGet()

Determine a set-key code block and condition-block

Syntax

      HB_SETKEYGET( <nKey> [, <bConditionByRef> ] )

Arguments

<anKey> is an numeric key value

<bConditionByRef> is an optional return-parameter

Returns

Current assigned action-block

Description

The HB_SetKeyGet() function returns the current code-block assigned to a key, and optionally assigns the condition-block to the return-parameter

Examples

      LOCAL bOldF10, bOldF10Cond
      bOldF10 := HB_SetKeyGet( K_F10, @bOldF10Cond )
      ... // some other processing
      SetKey( K_F10, bOldF10, bOldF10Cond )

Tests

      See test code above

Compliance

Harbour

Files

Library is rtl

Seealso

SETKEY(), HB_SETKEYSAVE(), HB_SETKEYCHECK()

hb_SetKeyCheck()

HB_SetKeyCheck()

Implements common hot-key activation code

Syntax

      HB_SetKeyCheck( <nKey> [, <p1> ][, <p2> ][, <p3> ] )

Arguments

<nKey> is a numeric key value to be tested code-block, if executed

<p1>..<p3> are optional parameters that will be passed to the code-block

Returns

True if there is a hot-key associated with <nKey> and it was executed; otherwise False If there is a hot-key association (before checking any condition): – if there is a condition-block, it is passed one parameter – <nKey> – when the hot-key code-block is called, it is passed 1 to 4 parameters, depending on the parameters passed to HB_SetKeyCheck(). Any parameters so passed are directly passed to the code-block, with an additional parameter being <nKey>

Description

HB_SetKeyCheck() is intended as a common interface to the SetKey() functionality for such functions as ACHOICE(), DBEDIT(), MEMOEDIT(), ACCEPT, INPUT, READ, and WAIT

Examples

      // within ReadModal()
      IF HB_SetKeyCheck( K_ALT_X, GetActive() )
         ... // some other processing
      ENDIF
      // within TBrowse handler
      CASE HB_SetKeyCheck( nInkey, oTBrowse )
         RETURN
      CASE nInKey == K_ESC
         ... // some other processing

Tests

      None definable

Compliance

Harbour

Files

Library is rtl

Seealso

SETKEY(), HB_SETKEYSAVE()

__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_SMALLWHEN

SMALLWHEN()

  Short:
  ------
  SMALLWHEN() Uses SMALLS() in a WHEN condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLWHEN([lShowOnUp],[lReturn],expDisplayString,[cTitle],;
       [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a WHEN condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  [lShowOnUp] If False (the default), smalls is not
  called when going backwards through the read (up arrow, etc), only when
  going forward.

  [lReturn]   This is simply the value to return. The
  default is False, which means the get is never 'edited'. A value
  of True means the smalls() lookup is done, and then the get is edited.

  Examples:
  ---------
   @3,0 GET V3 WHEN ;
       SMALLWHEN(.f.,.f.,"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when going forward
   // through the gets. If RETURN is pressed, the current GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // A False is returned, so the GET is not actually edited. The new
   // value is displayed, and the next get is made active.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG

 

SP_SMALLVALID

SMALLVALID()

  Short:
  ------
  SMALLVALID() Uses SMALLS() lookups in a VALID condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLVALID([bValid],expDisplayString,[cTitle],;
     [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a VALID condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  If the user selects a value from the SMALLS() lookup,
  a value of True is returned, allowing the next GET to be made
  active. Otherwise, a False is returned. The return value is also
  determined by [bValid]

  [bValid]  -  This is a code block that determines if
  the current get is already valid. If this is passed, it is first
  evaluated, and, only if the current get is NOT ALREADY VALID,
  SMALLS() is called with the SMALLS() parameters given. If this
  is not passed, SMALLS() is called automatically. IF this is
  passed and the GET is valid, a True is returned, allowing the
  next GET to be 'gotten'.

  Examples:
  ---------
   @3,0 GET V3 VALID  ;
       SMALLVALID({||!EMPTY(V3)},"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when attempting to exit
   // the get 'V3' where 'V3' is empty. A SMALLS() lookup is  called, with
   // smalls() parameters provided, and, if CR is pressed, the GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // If 'V3' is already valid, a True is returned, and the next GET is made
   // active. If SMALLS() is called and CR is pressed while in SMALLS(),
   // a True is returned. Otherwise a False is returned.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG