Pimping the numeric keypad

by Michael S. Kaplan, published on 2007/07/04 20:01 -07:00, original URI: http://blogs.msdn.com/michkap/archive/2007/07/04/3690200.aspx


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      0
42   NUMPAD1   0      1
43   NUMPAD2   0      2
44   NUMPAD3   0      3
3e   NUMPAD4   0      4
3f   NUMPAD5   0      5
40   NUMPAD6   0      6
3a   NUMPAD7   0      7
3b   NUMPAD8   0      8
3c   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)


# David Nesting on Thursday, July 05, 2007 2:09 PM:

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).

# Mihai on Thursday, July 05, 2007 4:49 PM:

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.


referenced by

2010/04/05 MSKLC, the Numeric Keypad, Lithuanian, and laptops....especially those laptops

2008/08/01 How do you key your num pad without going blind?

go to newer or older post, or back to index or month or day