[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Assign an action block to a key

     SETKEY(<nInkeyCode>, [<bAction>]) --> bCurrentAction


     <nInkeyCode> is the INKEY() value of the key to be associated or

     <bAction> specifies a code block that is automatically executed
     whenever the specified key is pressed during a wait state.


     SETKEY() returns the action block currently associated with the
     specified key, or NIL if the specified key is not currently associated
     with a block.


     SETKEY() is a keyboard function that sets or queries the automatic
     action associated with a particular key during a wait state.  A wait
     state is any mode that extracts keys from the keyboard except for
     INKEY(), but including ACHOICE(), DBEDIT(), MEMOEDIT(), ACCEPT, INPUT,
     READ and WAIT.  Up to 32 keys may be assigned at any one time.  At
     startup, the system automatically assigns the F1 key to execute a
     procedure or user-defined function named Help.

     When an assigned key is pressed during a wait state, the EVAL() function
     evaluates the associated <bAction> and the parameters, PROCNAME(),
     PROCLINE(), and READVAR().  It is, however, not necessary to list
     arguments when specifying <bAction> if you do not plan to use them
     within the action block.

     SETKEY() is like the SET KEY command which associates a procedure
     invocation with a key.


     .  This code fragment associates an action block with a key, and
        then, after getting a key using INKEY(), executes it with the EVAL()

        #include "Inkey.ch"
        SETKEY(K_DN, {|cProc, nLine, cVar| MyProc(cProc, ;
                          nLine, cVar)})
        . <statements>
        DO WHILE .T.
           nKey := INKEY(0)
           DO CASE
           CASE (bAction := SETKEY(nKey)) != NIL
              EVAL(bAction, PROCNAME(), PROCLINE(), READVAR())
           CASE nKey = K_PGUP
           CASE nKey = K_PGDN
           CASE nKey = K_ESC

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

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