Sorting it all Out Michael Kaplan's random stuff of dubious value Be sure to read the disclaimer here first!
Laurentiu Iancu asked:
Hello – Using MSKLC or otherwise, is it possible to view or edit the character codes generated by NumPad keys?I was actually going to check if there are any keyboard layouts that emit U+2212 Minus Sign when the minus key on the numerical keypad is depressed and realized that MSKLC does not show the keypad.Thank you,L.
It is not a rule, but it is something of a guideline that keyboard layouts try to include the versions of characters that will work best in ANSI applications when there is a choice in the matter, thus making U+2212 (MINUS SIGN) less desirable, generally speaking, than U+002d (HYPHEN-MINUS), though of course someone creating a keyboard layout is allowed to do what they want to do. :-)
Now as I previously pointed out in Why doesn't MSKLC have a numeric keypad?, MSKLC doesn't have a numeric keypad.
But in other posts (e.g. In case you have a yen to extend your keyboard (or at least want a yen?) and Pimping your Brazilian keyboard), I talked about how you could run kbdutool.exe directly after modifying the .KLC file to add particular keys. So, by extending that logic, there are a whole bunch of keys that, if you do not assign anything on them, pick up some default values, such as:
38 ADD 0 + +37 DIVIDE 0 / /36 MULTIPLY 0 * *39 SUBTRACT 0 - -46 NUMPAD0 0 042 NUMPAD1 0 143 NUMPAD2 0 244 NUMPAD3 0 33e NUMPAD4 0 43f NUMPAD5 0 540 NUMPAD6 0 63a NUMPAD7 0 73b NUMPAD8 0 83c NUMPAD9 0 9
So if you really and truly want to muck with one or more assignments over on the far side of the keyboard, you can -- by using these entries similarly to how you might from Pimping your Brazilian keyboard).
Though note that you may have limited success trying to use additional shift states, given all of the special low-level handling, some of which I hinted at in Getting all you can out of a keyboard layout, Part #6. Sticking to just the small number of shift state(s) that are used here (one for the numbers, two for the other keys) is probably for the best, all things considered. :-)
And before going down the road of trying to add native digits to the numeric keypad, keep in mind the way digit substitution works and how easy it is to mess that up for program that need the ASCII digits to treat them as numbers....
This post brought to you by − (U+2212, a.k.a. MINUS SIGN)
Modifying the numeric keypad to produce more meaningful characters actually sounds like a clever idea. I never use those keys on the keypad.
By the same token, the * key on the keypad ought to give us U+00D7 (MULTIPLICATION SIGN) and / should give us either U+00F7 (DIVISION SIGN) or U+2044 (FRACTION SLASH, perhaps when shifted).
The observation: "how easy it is to mess that up for program that need the ASCII digits to treat them as numbers" also applies to -,+, not only to the native digits.
Presumed regular reader and extraregular (ref: ordinary vs. extraordinary to understand extraregular
Are the scan codes correct? I added the following lines to my .klc file:
38 ADD 0 002b 00b137 DIVIDE 0 002f 00f736 MULTIPLY 0 002a 00d739 SUBTRACT 0 002d 2212
When validating the layout, I get a message that the "verification failed". The log reports:
ERROR: The scan code 39 is defined on both 6d (VK_SUBTRACT) and on 20 (VK_SPACE).
I also note that the scan codes for these keys are different under the KEYNAME and KEYNAME_EXT sections of the .klc file.