all groups > dotnet general > november 2004 >
You're in the

dotnet general

group:

Shortcuts with ContextMenu and toolbar


Shortcuts with ContextMenu and toolbar blabore
11/18/2004 10:47:01 PM
dotnet general: I have a MDI windows forms application that uses a toolbar on the parent
form. I've also setup a context menu on this form to be used as the dropdown
menu for one of the toolbar buttons. However, the shortcut keys for the
context menu do not seem to work for the menus, only clicking on them. Is it
possible to use shortcuts this way, or will shortcuts only work with a
RE: Shortcuts with ContextMenu and toolbar Jakob Christensen
11/19/2004 7:41:03 AM
Shortcut-keys normally work for context menus as well. How are you creating
the context menu?

Regards, Jakob.


[quoted text, click to view]
RE: Shortcuts with ContextMenu and toolbar blabore
11/20/2004 8:53:01 AM
Jakob,

Thanks for the response. I created the context menu through the form
designer, and also assigned the keyboard shortcuts at that time. My guess is
that this has something to do with using an MDI app, and the Main form isn't
"seeing" when the shortcut is pressed. Any ideas? I'm going to try and create
a sample app to see if I can reproduce the exact problem. Thanks again, Ben

[quoted text, click to view]
RE: Shortcuts with ContextMenu and toolbar Jakob Christensen
11/22/2004 4:09:02 AM
Ben,

I tried creating a toolbar with a context menu for the main form of an MDI
application and your are right - shortcuts do not work. I found a simple
workaround though. It's not very elegant but it works. If you create a
hidden main menu for the form which has the same event handlers and the same
shortcuts as the context menu, then it works fine.

HTH, Jakob.


[quoted text, click to view]
RE: Shortcuts with ContextMenu and toolbar blabore
11/22/2004 10:09:07 AM
Jakob,

Thanks again. I think your solution is the way to go. -Ben

[quoted text, click to view]
AddThis Social Bookmark Button