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.
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:
NLS functions can be assigned independently to each modifier combination via the combination's drop-down:
Current Windows versions support 15 NLS function types:
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:
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:
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.
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:
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.
Copyright © KbdSoft 2007-2022