BarCommand - Keyboard shortcuts not executed in wndproc

Docking/MDI for Windows Forms Forum

Posted 13 years ago by Keith Hill
Avatar
We've run into a bit of a problem with keyboard shortcuts. If your command leaks an exception it brings down the whole process since it executes in the context of message processing (which causes Application.Run to exit). It would be nicer if the keyboard shortcut handling posted a custom message (WM_USER+xx) to some Actipro window and in that window's wndproc you raised the command. Then if the command leaks an exception, we could catch that via the Application.ThreadException event and the application could continue to run.

Comments (4)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I was looking into this... the problem is that BarManager itself (which is called to fire off the command if a shortcut matches) doesn't have a WndProc.

I suppose we could make a NativeWindow and use that simply to send the custom message to, however it would have to be a "send", not a "post" operation since we need to know whether the key is handled or not. If it is handled, we have to prevent any control from getting it.

So with that in mind, would it change anything to add a NativeWindow if we are "sending" a custom message to it or would that essentially still have the problem from your perspective?


Actipro Software Support

Posted 13 years ago by Keith Hill
Avatar
I think that would work fine obviously as long as the native window is essentially invisible. This would be great because right now there is a pretty signficant difference in behavior when you execute a command by pressing a kbd shortcut vs. clicking a button.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This is added for the upcoming maintenance release.


Actipro Software Support

Posted 13 years ago by Keith Hill
Avatar
Thanks. That'll help us.
The latest build of this product (v2020.1 build 0400) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.