- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
this is why you frist rtfm
Admin
Keys.Home mapping to $ isn't the real issue.
The problem is that such key presses are typically stored in the keyboard as a 0x00 + another character. So pressing Home would add 0x00 0x24 to the keyboard buffer. So the code could work assuming argument e has a property denoting a special key and the code would check the value said property.
Edit Admin
Keyboards are actually pretty complicated. I could write a whole essay about scan codes, key codes, key modifiers, evolution in hardware abstraction from DOS to NT, but the simple gist is that you have the classic Windows key codes plus the classic DOS modifier flags to work with under .NET. And yes, those are correctly mapped for other platforms as well.
So that is the reason why you a key code plus modifier flags in the key args as well for the key events for those wondering.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.keyeventargs?view=windowsdesktop-9.0
Admin
I vaguely remember there not being KeyCodes and KeyUp/KeyDown events in the original .NET frameworks, and you had to do funky stuff with the KeyChars in that event. This might be carry over from that era?
Edit Admin
Yeah I wonder how that plays out with the screen KBs that all the cool kids use now.
Edit Admin
Yes, keyboards must be complicated for sure. Microsoft Teams hasn't been able to make some basic features work in non-US layouts, so what are the chances for a small development shop?
Edit Admin
Why check for keyboard accelerators manually? It's obviously using Windows, and Windows has functions to automatically handle keyboard shortcuts in the Windows OS itself. in fact the application loop typically handles all that stuff and stuffs the keyboard shortcut events into the queue automatically so you don't even need to know how the command was entered.
Admin
Ctrl-D "end of transmission" is really nice. When you don't feel like typing exit or quit in the terminal, just hit ctrl-D and you're out