Example - Using NLS functions to simulate togglable ROYA/LOYA modifier keys
Installer package: KbdEditInstallerSerbianLatinCyrillicAndGreekNlsRoyaLoya.exe
Note: the example is based on an idea suggested by KbdEdit users Ari Adler and Miroslav Karkuš.
You can use the installer package to deploy this keyboard layout without any restrictions. Free Demo version can be used to make changes and test them. To deploy a modified version, a Premium, Personal or Lite edition is needed.
Modifier keys Roya and Loya are normally "non-togglable", i.e. their modifier combinations are active only as long as the key is held in the "pressed down" state. Various use cases, like building multi-lingual "switchable" keyboards, could benefit from these keys being "togglable", i.e. their modifier positions remaining active even after the user has released the key, like how the built-in Caps Lock and togglable Kana operate.
This example shows how the advanced NLS functions can be used to simulate Roya/Loya "togglability".
The "togglability" effect is achieved by setting up alternative key up NLS functions, which intercept the "key up" event of the Roya/Loya keys in a way that tricks the OS into thinking that the Roya (i.e. Loya) key has remained pressed down even after the physical key has been released.
The original key's "key up" event is not merely suppressed (the "No Event" alternative key up function). Instead, the "Send Param VK" function is used to send the "key up" event of the opposite Roya/Loya key. When Loya is pressed down, releasing it is sending the Roya "key up" event, and vice-versa. This achieves a double function of:
This way, the user does not have to remember to turn Roya off manually before turning the Loya on.
To avoid the need for two dedicated physical Roya/Loya keys, their virtual codes are simulated as Ctrl-only functions of the Caps Lock and VK_OEM_7 keys:
Note that a similar technique of overloading an existing key to perform an alternative Ctrl-only function is demonstrated in another example Using NLS functions to make Caps Lock and Alt Gr share the same key.
The Roya (i.e. Loya) key can be explicitely "un-toggled" via a Ctrl-only alternative NLS function of another two physical keys:
These combinations revert the layout to the "both Roya and Loya off" mode, in which the plain Base/Shift/AltGr modifier combinations are active.
Step by step instructions
The instructions show how to build an alternative version of an earlier example Tri-lingual Serbian Cyrillic / Latin / Greek keyboard.
The alternative "Serbian Cyrillic" and "Greek" layouts are mapped to the togglable ROYA and LOYA keys, unlike the original example, where they are mapped to the separate Caps Lock and togglable Kana positions.
The use of ROYA instead of Caps Lock has the benefit of allowing the Caps Lock to keep its original "Capital Letters" function, although unfortunately this works only for the BASE (Serbian Latin) position.
Start by opening the standard Serbian (Latin) layout (KLID 0000081A).
Enable the ROYA and LOYA modifier combinations
Switch to the Low-level editor.
Tick the LOYA checkbox to enable the "Loya" modifier key (KANA and ROYA checkboxes will be automatically ticked as well).
Enable the following modifier combinations, i.e. move them from "Unused modifier combinations" to "Active modifier combinations":
The "modifiers" section should now look like this:
Define special NLS functions for the ROYA key
Set the Caps Lock key's NLS functions to turn ROYA on on key down and turn LOYA off on key up:
Next, set the Left Win key to turn ROYA off on key up:
Define special NLS functions for the LOYA key
Set the VK_OEM_7 key's NLS functions to turn LOYA on on key down and turn ROYA off on key up:
Next, set the VK_OEM_MINUS key to turn LOYA off on key up:
Copy the dead tables
Both the Serbian Cyrillic (KBDYCC.DLL 00000c1a) and Greek (KBDHE.DLL 00000408) layouts have dead tables of their own. These can be easily imported using the Dead-key editor's Import dead char from table command.
It is important to tick the Merge with current dead table radio button, which produces the desired end result of an amalgamation of all three layouts' dead tables.
The In case of merge conflict radio buttons can be left in either state, since the three dead tables are mergable without conflicts. The only semi-conflicting dead key is 00A8 ¨ , which appears as Diaresis in Serbian Latin, and Dialytika in Greek, but the two dead keys have disjoint sets of transformation pairs that neatly coexist in the new merged dead key.
Copy the "Serbian Cyrillic" and "Greek" layout mappings to the Roya/Loya positions
With the ROYA/LOYA switching and dead key groundwork laid out, it is now time to switch to the High-level editor and assign the two alternative layouts' mappings to ROYA and LOYA positions:
Note that the original layouts' Ctrl positions are omitted, as they only contain rarely used ASCII control characters..
The easiest method for copying mappings from another layout is to open the "donor" layout in another KbdEdit instance and use it as a drag/drop source. All keys / modifier positions mappings can then be dragged one by one into the target instance - a little repetitive, but still easily doable in a few minutes. This technique is described in detail in an earlier example (Multi-lingual English / French keyboard using togglable KANA).
One important difference is that, in a ROYA/LOYA-based layout, all keys need to be copied this way, even those whose mappings are identical between the source and target layouts. The ROYA/LOYA keys don't have an equivalent of the KANALOK flag, so it is not possible to make them selectively affect only keys that genuinely need switching.
In practice, this means that it is also necessary to manually copy the mappings for the Space bar, the Tab, Escape, Backspace and Enter keys, as well as all of the numeric keypad keys.
Special attention should be paid to original layouts' dead keys - when dropping them into the target layout, Map as dead key should be chosen from the pop-up menu:
Copyright © KbdSoft 2007-2021