FT_SCANCODE

FT_SCANCODE()
 Wait for keypress and return keyboard scan code

 Syntax

      FT_SCANCODE() -> cCode

 Arguments

     None

 Returns

     A two-character string, corresponding to the keyboard scan code.

 Description

     FT_SCANCODE() enables you to distinguish the different scancodes
     of similar keys (such as Grey minus versus regular minus), thus
     increasing the number of keys your input routine can recognize.

     It works like INKEY(), in that it waits for a key to be pressed.
     The scan code consists of two bytes, which are returned as a
     two-character string.

     For example, calling FT_SCANCODE() and pressing the Grey-minus
     key will return a two character string:

            CHR(45) + CHR(74)

     LASTKEY() is not updated by FT_SCANCODE(), so don't try to
     test LASTKEY() to see what was pressed during an FT_SCANCODE()
     call.  Simply assign the return value to a variable and test
     that (see the test driver below).

     *  This was adapted from a short C routine posted by John Kaster on
        NANFORUM.  It was written in Clipper to help demonstrate the
        FT_INT86 function of the Nanforum Toolkit.

     This program requires FT_INT86().

 Examples

        cKey := FT_SCANCODE()

      [grey-] returns:  CHR(45) + CHR(74)
      [-]     returns:  CHR(45) + CHR(12)
      [grey+] returns:  CHR(43) + CHR(78)
      [+]     returns:  CHR(43) + CHR(13)

 Source: SCANCODE.PRG

 Author: Glenn Scott (from John Kaster)

 

FT_PUTKEY

FT_PUTKEY()
 Stuff a keystroke into the keyboard buffer

 Syntax

     FT_PUTKEY( <nKeyValue> ) -> lResult

 Arguments

    <nKeyValue> is the INKEY() value of the keystroke to be stuffed.

 Returns

   .T. if the keystroke was put into the keyboard buffer.
   .F. if nKeyValue was invalid or the buffer was full.

 Description

   This function is similar to the KEYBOARD command, with a few
   exceptions. First, this function does not clear the keyboard buffer
   before inserting the keystroke.  In addition, since it uses the
   Inkey() value, you can stuff any key, including function keys, into
   the keyboard buffer. However, this also means that unlike the KEYBOARD
   command, you can only stuff one keystroke at a time.

   You can easily create a User-Defined Command that makes this function
   even more like the KEYBOARD command.  For example,

       #command KEYSTROKE <key> => FT_PUTKEY( <key> )

   will create a command called KEYSTROKE that could be used as a
   companion command to KEYBOARD.  The only difference is that it would
   insert a single keystroke instead of a string.

   Be aware that this function makes use of Clipper's internal event
   handler.  If you don't like using internals, then don't use this
   function, you sniveling coward.

   This function is written to adhere to Turbo Assembler's IDEAL mode.
   To use another assembler, rearrange the SEGMENT and PROC directives
   and make any other necessary changes to the source code.

 Examples

     FT_PUTKEY( -9 )   //  Stuff the F10 key
     FT_PUTKEY( 276 )  //  Stuff the Alt T key
     KEYSTROKE 28      //  Stuff the F1 key using a User-Defined Command

 Source: PUTKEY.ASM

 Author: Ted Means

 

FT_LASTKEY

FT_LASTKEY()
 Force LastKey() to return a programmer-defined value.

 Syntax

     FT_LastKey( <nKey> ) -> NIL

 Arguments

    <nKey> is the Inkey() value of the desired key.

 Returns

    NIL

 Description

    It is occasionally useful to force LastKey() to return a known value.
    This is easily accomplishing by using the KEYBOARD command, but this
    has undesireable side effects (the keyboard buffer is cleared, and
    the keystroke is processed whether you needed it to be or not).  This
    function accomplishes the same task but without the side effects.  It
    does so by directly modifying the memory location where Clipper stores
    the LastKey() value.

    Some highly unorthodox programming techniques, not to mention rather
    strange use of Clipper internals, was necessary to make this function
    work.  If this makes you uncomfortable, then don't use this function,
    you worthless crybaby.

 Examples

    keyboard chr( K_ESC )

    ? lastkey()  // returns 27

    FT_LastKey( K_F1 )

    ? lastkey()  // now returns 28

 Source: SETLASTK.ASM

 Author: Ted Means