In my main application Form I have a number of menu and toolbar button functions to which I have assigned shortcut keys such as F10, F11 and F12. The shortcuts work well except for instances where certain controls have focus, such as a 3rd-party grid control. In that case the F11 or other shortcuts are handled by that control and swallowed… they never make it to my event handler of the main UI.
I don’t really want to, and can’t with the 3rd party controls, modify each control (there are dozens) to pass on my F* keys. I thought of hooking the app’s message pump but that seems like a severe solution. Is there a better, cleverer way to handle this situation?
(This is a .NET WinForms MDI (2.0) application which hosts many kinds of home-spun as well as 3rd party components.)
Here is what I tried:
None of these worked although either one should have. It’s my suspicion that the offending child control does something similar and is not playing nice. It’s an old Win32 OCX and might actually be doing something really nasty such as hooking into the messages at the OS level. Not sure.
In any case, the workaround was to use Alt + SomeOtherKey. For whatever reason, using Alt + D instead of F11 allows the message handling and focus/view change to take place properly.
This solution is a hack around a 3rd-party control and a genuine black-box issue. I wish I knew exactly what was going on but I don’t though I suspect that the 3rd party control has its own hooks into the message pump and is intercepting the F*-keys.