SET KEY

SET KEY

Assign an action block to a key

Syntax

      SET KEY   <anKey> to p<bAction>] [when  <bCondition> ]  )

Arguments

<anKey> is either a numeric key value, or an array of such values

<bAction> is an optional code-block to be assigned

<bCondition> is an optional condition code-block

Description

The Set Key Command function is translated to the SetKey() function witch returns the current code-block assigned to a key when called with only the key value. If the action block (and optionally the condition block) are passed, the current block is returned, and the new code block and condition block are stored. A group of keys may be assigned the same code block/condition block by using an array of key values in place on the first parameter.

Examples

      LOCAL bOldF10 := SetKey( K_F10,  {|| Yahoo() } )
      ... // some other processing
      SET KEY K_F10 TO bOldF10
      ... // some other processing
      bBlock := SetKey( K_SPACE )
      IF bBlock != NIL ...

         // make F10 exit current get,  but only if in a get - ignores other
         // wait-states such as menus,  achoices,  etc...
         SetKey( K_F10,  {|| GetActive():State := GE_WRITE },  ;
            {|| GetActive() != NIL } )

Compliance

SET KEY is mostly CA-Cl*pper compliant. The only difference is the addition of the condition code-block parameter, allowing set-keys to be conditionally turned off or on. This condition-block cannot be returned once set – see SetKeyGet()

Seealso

hb_SetKeySave()

2 responses to “SET KEY

  1. Pingback: Harbour Commands | Viva Clipper !

  2. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.