Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>setkxlat()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SETKXLAT()
 Redefines key codes or lock keys
------------------------------------------------------------------------------
 Syntax

     SETKXLAT([<nOrgKeyValue>],[<nNewKeyValue>])
        --> lAccepted

 Arguments

     <nOrgKeyValue>  Designates the original key code that is translated
     into the value of <nNewKeyValue>.

     <nNewKeyValue>  Designates a new key code for <nOrgKeyValue>.  If
     not specified, SETKXLAT() turns off the key translation designated by
     <nOrgKeyValue>.

     ()  Calling this function without a parameter uninstalls all of the key
     translations previously performed.

 Returns

     SETKXLAT() returns .T. when the translation code is successfully
     installed, and .F. if a parameter contains errors or additional memory
     can not be allocated.  The number of allowable key code translations can
     be calculated as follows:

     maximum allocatable memory / 4

 Description

     With this function, keyed input can be translated or even switched off.
     Symbolic constants for the codes have been defined in the CTSCAN.CH
     include file.  The following formula applies to each key:

     cKeyValue = CHR(ASCII) + CHR(SCAN_CODE)

     Many key combinations have no ASCII equivalent.  In these cases, the
     CHR(ASCII) byte is 0.  However, some key and key combinations have a
     scan code, allowing the differentiation of keys with the same ASCII code
     (e.g.  the decimal point on the numeric key pad and the period in the
     alpha numeric field).

     Scan code 0 is returned when you input an ASCII code through the numeric
     key pad in the form Alt + <number>.

     When the function is called without <cNewKeyValue>, the translations
     specified in <cOrgKeyValue> are uninstalled.

     Calling the function without any parameters discards all existing
     translations.

 Notes

     .  The numeric coding previously used for the key codes is still
        valid.

     .  All symbolic constants from the CA-Clipper file INKEY.CH can
        be used.

     .  A new translation for a key overwrites the previous one.

     .  Memory for the key code translations is allocated dynamically.

 Examples

     .  Press the "A" and the keyboard returns the code of "B' (in
        reality you would seldom use this):

        SETKXLAT(KS_A, KS_B)                   // .T. if successful

     .  Translate the left arrow into the down arrow on the key pad.
        Both keys then return the same code:

        ? SETKXLAT(KS_LEFT, KS_DOWN)           // .T. if successful

     .  Turn the up arrow in the cursor control block off.  Key code:

        ? SETKXLAT(KS_DOWN, KS_DISABLE)        // .T. when successful

     .  Turn the up arrow back on:

        ? SETKXLAT(KS_DOWN)

     .  Uninstall all translations:

        SETKXLAT()


See Also: GETKXLAT() GETKXTAB() SETKXTAB()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson