|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Keyboard shorcuts & multiple formsI'd like to add keyboard shorcuts to my program. I'm writing an application
that has many top-level forms that reside on the desktop. When the focus is one form, other forms can't respond to short cuts. Some of my shortcuts are program-wide. What are my options? I see a few: 1) Add each short cut to each form (bad) 2) Have each form call a central function to check program-wide keys (not as bad) 3) Add a message filter on the application (pretty bad) Is there some really simple, elegant way that I've missed. In MFC's message routine, the application object could respond to any short cut messages. Is there anything similar in .NET? Thanks, Noah
Show quote
"Noah Stein" wrote: Actually #3 is not that bad. You can add your own message filter with > I'd like to add keyboard shorcuts to my program. I'm writing an application > that has many top-level forms that reside on the desktop. When the focus is > one form, other forms can't respond to short cuts. Some of my shortcuts are > program-wide. What are my options? I see a few: > > 1) Add each short cut to each form (bad) > 2) Have each form call a central function to check program-wide keys (not as > bad) > 3) Add a message filter on the application (pretty bad) > > Is there some really simple, elegant way that I've missed. In MFC's message > routine, the application object could respond to any short cut messages. Is > there anything similar in .NET? Application.AddMessageFilter and intercept all keyboard input in your application. We offer a .NET component that's FREE for non-commercial use that will do all this for you: http://www.mini-tools.com/goto/input |
|||||||||||||||||||||||