Hot Keys and altGr
The earlier post, RichEdit Hot Keys, lists all built-in RichEdit hot keys. In particular, it lists a popular hot key for typing the Euro (€), ctrl+alt+e, which works for some languages, such as US English. A problem may arise when altGr+e is assigned to some other character, such as é in Spanish keyboards. This is because altGr generates a left ctrl + right alt key down combination, instead of a right alt key down combination. RichEdit avoids a conflict by not treating left ctrl + right alt key combinations as hot keys. So with RichEdit and Word, it's easy to insert both € and é using a Spanish keyboard. In contrast Notepad, PowerPoint and Excel insert é for both left ctrl + left alt and for left ctrl + right alt on Spanish keyboard layouts and they don't insert anything for either on the standard US English keyboard layout.
You can even know the difference between altGr and left ctrl + right alt. Here's how. In general pressing the left alt key sends a WM_SYSKEYDOWN message with wparam = VK_MENU and the KF_EXTENDED flag (lparam bit 24) set to 0. On keyboard layouts that don't have altGr combinations, pressing the right alt key sends a WM_SYSKEYDOWN message with the KF_EXTENDED flag set to 1. The KF_EXTENDED flag tells you the difference between left and right, something every child should know.
Pressing a left/right ctrl key sends a WM_KEYDOWN message with wparam = VK_CONTROL and the KF_EXTENDED flag = 0/1, respectively.
On keyboard layouts that appropriate the right alt key for altGr, pressing altGr sends both a WM_KEYDOWN message for a left ctrl and a WM_KEYDOWN message for a right alt. Since the right alt key down message is WM_KEYDOWN rather than WM_SYSKEYDOWN, you know it's an altGr and not the regular right alt key. Furthermore on such keyboard layouts, you can't use the right alt key to access menus since it doesn't generate a WM_SYSKEYDOWN message.
As a result, it's easy to treat leftctrl+leftalt+e differently from altGr+e. I tried out this methodology with a Spanish keyboard, for which altGr+e gives é. Sure enough leftctrl+leftalt+e inserts € and altGr+e inserts é. You can have your cake and eat it too! But it's probably good enough just not to use left ctrl + right alt for ctrl+alt hot keys which is the approach RichEdit has followed for years.
A question for future program design is whether altGr is even a good thing. On soft keyboards, you don’t need altGr since you can hold down a key to access a surround menu of related characters. But the need to enter more characters than given by the usual keyboard keys + shift hasn’t changed. This is true of European languages and even of English, since English includes many accented words imported from other languages. It’s even truer for math, which has a large character set. So for hard keyboards, more “shift” keys are better than fewer and appropriating the right alt key as altGr is a useful aid in accessing larger alphabets.
Occasionally I think of how silly it was for Apple to have had only one mouse button. The rationale was that people were incapable of handling more than one button. But can any of us imagine having only a single mouse button today? Meanwhile many people are musical and musical instruments often involve chording. With practice, people can do amazing things and keyboard chording of various kinds can give access to very large sets of characters. People without the inclination and/or dexterity to use hot keys aren’t forced to use them. But other people at least have simpler ways to enter some of the less common characters for their language(s) than using an insert-symbol dialog or entering the Unicode value for a character and typing alt+x to convert the value to the character. altGr doesn’t give access to that many more characters, but it does allow alphabetic and Indic languages to be typed without resorting to more exotic input methods.
Comments
Anonymous
April 24, 2015
The comment has been removedAnonymous
April 24, 2015
(Sorry, "formulae" should be "formula". And you have to remove the ">" from the URLs.)Anonymous
May 04, 2015
I see that the Office 2016 preview is now available. Are there any major changes to Math handling that make this an essential download? I don't suppose native equation numbering has been added?Anonymous
May 04, 2015
A couple of math improvements have been added to Word 2016 and PowerPoint 2016 including the equation-array equation number placement on the right side as in OneNote 2013. This doesn't do the equation numbering for you, but at least you can stick whatever you want flushed over to the right margin. The input for this is described in Unicode Technical Note #28, Section 3.21 Equation Numbers. At least it's a start :-) If you insert an AutoNum field (Insert/Quick Parts/Field...) into what you flush right, Word will autonumber it for you and you can use bookmarks to refer to the equations. I'll write a post about it pretty soon.Anonymous
May 04, 2015
The comment has been removedAnonymous
May 06, 2015
The comment has been removed