[Home] [Purchase] [Download] [Manual] [Acknowledgements] [Sitemap] [Release Notes] [FAQ]

Up ] Editing VK Mappings ] Modifiers ] Special NLS functions ] [ Special NLS Functions Editor ] Mouse keys ] List of Virtual Key Codes ]

Special NLS Functions Editor

The "Special NLS Functions" editor is accessed from the Low-level editor through the "Edit" button, which shows up when the "Special NLS Functions" dropdown is set to "Advanced". It is also accessible from the context menu through the "NLS functions" option.

KbdEdit Special NLS function dropdown Advanced KbdEdit NLS functions popup menu item

The dialog enables a detailed setting of NLS functions for the chosen virtual key. The functions are set separately for each of the 8 possible combinations of the Shift, Ctrl and Alt modifiers. Optionally, separate functions can be set for the "key up" events:

KbdEdit Special NLS function editor dialog

NLS function types

NLS functions can be assigned independently to each modifier combination via the combination's drop-down:

KbdEdit Special NLS function editor dialog function types dropdown

Current Windows versions support 15 NLS function types:

Function type Description
No Event Do nothing - the keypress is ignored
Send Base VK Keep the original key's function, as defined by its VK code
Send Param VK Emulate keypress of an alternative VK code, defined through the supplied parameter
Kana Lock Functions specific to FE languages and their Input Method Editors (IMEs).
At the time of writing, their exact functioning is not known yet.
More information will be provided as it becomes available.
Alpha Num
Hiragana
Katakana
Sbcs-Dbcs
Roman
Code Input
Help or End
Home or Clear
Numpad
Kana Event
Conv or Non-conv

VK parameters

The "Send Param VK" and "Kana Event" functions require an additional VK code parameter. This is provided through a separate drop down, which shows up when either of the functions is active:

KbdEdit Special NLS function editor dialog param VK dropdown

Alternative key-up functions

Normally, the same NLS function is active for both the "down" and "up" keypresses of the same VK code. However, if a "Keydown switches to alternative keyup functions" checkbox is checked for any of the modifier combinations, a separate set of "key up" functions becomes available for all combinations, as shown in the above screenshot taken from the standard KBDJPN.dll Japanese keyboard layout.

The alternative key-up functions are quite convoluted and counter-intuitive, so here is an attempt to explain and summarise them to the best of author's ability:

  • For the combinations where the "Keydown switches to alternative keyup functions" checkbox is not checked, pressing down the key will behave as expected, ie the same set of "key down" functions will be used when the key is released.
     
  • For combinations where the check box is checked, pressing down the key generates the "key down" NLS function defined in the left-hand column, as expected.
    However, the keypress also switches the keyboard processing "state machine" into an "alternative key up" state, where the functions defined in the right-hand "Alternative key up functions" column are used for the subsequent "key up" event, whether the original Shift/Ctrl/Alt combination is still active or not.
    Once the key is released, the "state machine" reverts back to the normal state, where the next "key down" event is interpreted in accordance with the normal (ie not key-up) set of functions.

The rationale behind the alternative key-up functions is unclear - they may have been necessary to support specific interactions between the keyboard and its associated IME editor.

In certain FE layouts, they also seem to be used to minimise the occurrence of a NLS function getting stuck in the "key down" state. This can happen if the user depresses/releases some of the Shift/Ctrl/Alt modifiers while a key with special NLS functions is still down, ie before it is released. In these scenarios, it helps to define the original "key down" NLS function on additional modifier combinations, but for the "key up" event only, so that releasing the key cleanly turns off the same NLS function, instead of sending a "key up" event for a different NLS function that may be defined for the (now different) active modfiier combination.

This example shows how alternative key-up functions can be used to simulate "togglability" of the Roya/Loya modifier keys.

A closer look at the "Alternative VK code" NLS function

The "Special NLS functions" dialog can help de-mystify the Alternative VK code NLS functions. As an example, we'll look at the alternative VK code function mapped to Ctlr+VK_OEM_2 (from this example layout). Opening up the dialog for this VK code reveals "alternative VK code" inner workings:

KbdEdit Special NLS function editor dialog Alternative VK code

  • The unaffected modifier positions have the Send Base VK function, ensuring that the original VK code is generated.
     
  • The modifier combinations that generate the alternative VK code have the Send Param VK function, with the alternative VK code set as the Param VK.
    This is how the original VK code is "mutated" into the alternative one.
     
  • The same combinations also have the Keydown switches to alternative keyup functions checkbox checked.
     
  • In the Alternative key-up functions column, all modifier combinations are set to the Send Param VK function, with the same "alternative" VK code as the parameter.

The last two points are important for the (relatively) smooth co-existence of the key's original and alternative VK codes. They ensure that the "alternative" VK is always cleanly returned to "up" state when the user releases the physical key, instead of getting stuck in the "down" position if the modifier combination has changed. Without them, the user would have to be very careful not to alter the current Shift/Ctrl/Alt combination before releasing the key.

The "anti-stick" protection is not perfect though - it does not prevent the original VK code from getting stuck in certain edge scenarios, as described in Limitations of Alternative VK code customisations.

Manual index

Copyright © KbdSoft 2007-2023