FT_SETKEYS

FT_SETKEYS()
 Get array of keys redirected via the SetKey() or SET KEY

 Syntax

     FT_SetKeys() --> aKeyValues

 Arguments

    None

 Returns

    An array from 0 to n elements, where n is the number of keys that
    have been redirected via SetKey().  Each element in the array contains
    the Inkey() value of a key that has been redirected.

 Description

    Nantucket encourages Clipper programmers to write modular code -- black
    boxes that do not modify any global settings without resetting them
    on exit.  In the past, this has proven cumbersome where SetKey() is
    concerned, because the only way to see if a key had been redirected
    was to call SetKey() and see if it returned NIL or a code block.  To
    check every possible key value was unacceptably slow.

    This function attempts to alleviate this problem by returning an array
    that contains only those keys that have been redirected.  It is
    substantially faster than the method mentioned above because it
    directly accesses Clipper's internal table of redirected keys.

    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 snivelling coward.

 Examples

    local aKeys := FT_SetKeys()    // Get the key table
    local aBlox := {}              // Create a parallel array
    local i

    for i := 1 to len( aKeys )
      // Nullify all redirections, while saving code block
      // for later restoration

      aadd( aBlox, setkey( aKeys[ i ], NIL )
    next

    // Do some stuff

    for i := 1 to len( aKeys )
      // Restore the redirections

      setkey( aKeys[ i ], aBlox[ i ] )
    next

 Source: SETKEYS.ASM

 Author: Ted Means

 

FT Keyboard-Mouse

 FT_ALT()         Determine status of the Alt key
 FT_CAPLOCK()     Determine and optionally change the status of CapLock key
 FT_CTRL()        Determine status of the Ctrl key
 FT_LASTKEY()     Force LastKey() to return a programmer-defined value.
 FT_MBUTPRS()     Retrieve button press status
 FT_MBUTREL()     Get mouse button release information
 FT_MCONOFF()     Turn mouse cursur off if in specified region
 FT_MCURSOR()     Set the mouse cursor
 FT_MDBLCLK()     Return true if a double click was detected
 FT_MDEFCRS()     Define the mouse cursor
 FT_MGETCOORD()   Get mouse cursor position (text coord.) and button status
 FT_MGETPAGE()    Get the display page for the mouse pointer
 FT_MGETPOS()     Get mouse cursor position and button status
 FT_MGETSENS()    Get the mouse sensitivity parameters
 FT_MGETX()       Get mouse cursor row position
 FT_MGETY()       Get mouse cursor column position
 FT_MHIDECRS()    Decrement internal mouse cursor flag and hide mouse cursor
 FT_MINIT()       Initialize the mouse driver, vars and return status of mouse
 FT_MINREGION()   Test if the mouse cursor is in the passed region
 FT_MMICKEYS()    Get mickeys
 FT_MRESET()      Reset mouse driver and return status of mouse
 FT_MSETCOORD()   Position the mouse cursor using text screen coordinates
 FT_MSETPAGE()    Set the display page for the mouse pointer
 FT_MSETPOS()     Position the mouse cursor using virtual screen coordinates
 FT_MSETSENS()    Set the mouse sensitivity parameters
 FT_MSHOWCRS()    Increment internal cursor flag and display mouse cursor
 FT_MVERSION()    Get the mouse driver version
 FT_MXLIMIT()     Set vertical bounds of mouse using virtual screen coord.
 FT_MYLIMIT()     Set horiz. bounds of mouse using virtual screen coordinates
 FT_NUMLOCK()     Return status of NumLock key
 FT_PRTSCR()      Enable or disable the Print Screen key
 FT_PUTKEY()      Stuff a keystroke into the keyboard buffer
 FT_SCANCODE()    Wait for keypress and return keyboard scan code
 FT_SETKEYS()     Get array of keys redirected via the SetKey() or SET KEY
 FT_SETRATE()     Set the keyboard delay and repeat rate on PC/AT & PS/2
 FT_SHIFT()       Determine status of shift key
 FT_SINKEY()      Replacement for INKEY() that tests for SET KEY procedures

 

FT_SINKEY

FT_SINKEY()
 Replacement for INKEY() that tests for SET KEY procedures

 Syntax

      FT_SINKEY( [ <nWaitTime> ] ) -> nKey

 Arguments

     <nWaitTime> is the number of seconds to wait.  If zero,
     FT_SINKEY() will wait indefinitely for a keypress.  If not
     passed, FT_SINKEY() does not wait for a keypress.  If NIL,
     it is treated the same as 0.

 Returns

     The INKEY() value of the key pressed.

 Description

     FT_SINKEY() is similar to the function provided by Nantucket in
     KEYBOARD.PRG, with one significant difference: you can pass NIL
     to INKEY(), which will be treated as a zero (i.e., wait indefinitely
     for keypress).  Therefore, it is necessary to differentiate between
     an explicit NIL and one that is a result of a formal parameter NOT
     being received.

     FT_SINKEY() differs from the standard INKEY() in that it will
     respond to any keys set with SET KEY TO or SetKey().

 Examples

     SetKey( K_F1, {|n,l,r| Help(n,l,r) } )
     nKey := FT_SINKEY(0)       // Help() will be called if F1 pressed

 Source: SINKEY.PRG

 Author: Greg Lief

 

FT_SETRATE

FT_SETRATE()
 Set the keyboard delay and repeat rate on PC/AT & PS/2

 Syntax

     FT_SETRATE( [ <nDelayTime> ] [, <nRepeatRate> ] ) -> NIL

 Arguments

    <nDelayTime> is the keyboard delay time.

    <nRepeatRate> is the keyboard repeat rate.

         +-----------------------+  +------------------------+
         | nDelayTime      DELAY |  | RepeatRate      SPEED  |
         |-----------------------|  |------------------------|
         |     0           250ms |  |    0           30.0cps |
         |     1 (default) 500ms |  |    1           26.7cps |
         |     2           750ms |  |    2           24.0cps |
         |     3          1000ms |  |    3           21.8cps |
         +-----------------------+  |    4           20.0cps |
                                    |    5           18.5cps |
                                    |    6           17.1cps |
                                    |    7           16.0cps |
                                    |    8           15.0cps |
                                    |    9           13.3cps |
                                    |   10           12.0cps |
                                    |   11           10.9cps |
                                    |   12 (default) 10.0cps |
                                    |   13            9.2cps |
                                    |   14            8.6cps |
                                    |   15            8.0cps |
                                    |   16            7.5cps |
                                    |   17            6.7cps |
                                    |   18            6.0cps |
                                    |   19            5.5cps |
                                    |   20            5.0cps |
                                    |   21            4.6cps |
                                    |   22            4.3cps |
                                    |   23            4.0cps |
                                    |   24            3.7cps |
                                    |   25            3.3cps |
                                    |   26            3.0cps |
                                    |   27            2.7cps |
                                    |   28            2.5cps |
                                    |   29            2.3cps |
                                    |   30            2.1cps |
                                    |   31            2.0cps |
                                    +------------------------+

 Returns

   NIL

 Description

   This routine is used to adjust the IBM PC/AT and PS/2 "typematic"
   repeat and delay feature.  This is used to allow the users of your
   application to adjust these speeds to the most comfortable level.

   This source code is written for Microsoft Assembler v5.1.

 Examples

   FT_SETRATE(0,0)    // Set keyboard to fastest possible settings
   FT_SETRATE()       // Set keyboard to AT defaults (10.9cps,500ms delay)
   FT_SETRATE(11,1)   // Set keyboard to PS/2 defaults (10cps,500ms delay)

 Source: KSPEED.ASM

 Author: James R. Zack

 

FT_SHIFT

FT_SHIFT()
 Determine status of shift key

 Syntax

      FT_SHIFT() -> lValue

 Arguments

     None

 Returns

     .T. if a shift key is pressed, .F. if otherwise.

 Description

     This function is useful for times you need to know whether or not the
     shift key is pressed, such as during a MemoEdit().

 Examples

     IF FT_SHIFT()
        @24, 0 say "Shift"
     ELSE
        @24, 0 say "     "
     ENDIF

 Source: SHIFT.C

 Author: Ted Means

See Also: FT_CAPLOCK() FT_CTRL() FT_NUMLOCK() FT_PRTSCR() FT_ALT()



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_PRTSCR

FT_PRTSCR()
 Enable or disable the Print Screen key

 Syntax

      FT_PRTSCR( [ <lSetStat> ] ) -> lCurStat

 Arguments

     <lSetStat> set to .T. will enable the Print Screen key,
     .F. will disable it.  If omitted, leaves status as is.

 Returns

     The current state: .T. if enabled, .F. if disabled.

 Description

     This function is valuable if you have a need to disable the
     printscreen key.  It works by fooling the BIOS into thinking that
     a printscreen is already in progress.  The BIOS will then refuse
     to invoke the printscreen handler.

 Examples

     FT_PRTSCR( .F. )       && Disable the printscreen key
     FT_PRTSCR( .T. )       && Enable the printscreen key
     MemVar := FT_PRTSCR()  && Get the current status

 Source: PRTSCR.C

 Author: Ted Means

See Also: FT_CAPLOCK() FT_CTRL() FT_NUMLOCK() FT_SHIFT() FT_ALT()

FT_NUMLOCK

FT_NUMLOCK()
 Return status of NumLock key

 Syntax

      FT_NUMLOCK( [ <lNewSetting> ] ) -> lCurrentSetting

 Arguments

     <lNewSetting> is optional and if supplied is the new setting
     for the CapLock key.  Specify .T. to turn CapLock on, or .F. to
     turn it off.

 Returns

     lValue is .T. if NumLock is set, .F. if it isn't set.  The value
     returned represents the setting in effect prior to any changes that
     might by made by <lNewSetting>.

 Description

     This function is useful if you need to know or set the status of the
     NumLock key for some reason.

 Examples

     IF FT_NUMLOCK()
        Qout( "NumLock is active" )
     ENDIF

   Another one, slightly strange, courtesy of Glenn Scott:

       function numBlink()
          local lOldNum := ft_numlock()

          while inkey( .5 ) != 27
             ft_numlock( !ft_numlock() )
          end

          return ft_numlock( lOldNum )

 Source: NUMLOCK.C

 Author: Ted Means

See Also: FT_CAPLOCK() FT_CTRL() FT_PRTSCR() FT_SHIFT() FT_ALT()



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