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() To download this example - click here.
See Also: GETKXLAT() GETKXTAB() SETKXTAB()