Question

I am making use of ContextMenuStrip in my program and apparently, it wont show its shortcut keys (mnemonics, those that should be shown as underlines under letters preceded by &) unless i press Alt, but when i press Alt, the shown ContextMenuStrip will hide because the main menu of the form will receive focus. Thus, in context menus, mnemonics are never seen!

Is there a way to force this behavior to be on for my program? I've read elsewhere that you can change it somewhere in the system settings, but i need people using my software to always see mnemonics, not require them globally changing their systems for my program to work correctly!

I have to show this menu via code in the KeyDown event handler when user presses Enter because its a popup for quick edit of a value represented by control. User clicks the control and can quickly change its contents. Think of it like in C# when you have a popup that pops on ctrl+space hinting possible code snipplets you can insert in this exact spot. So using it as a "context menu" property of a control or using keyboard "show context menu" button doesnt apply.

Thanks!

Was it helpful?

Solution

That is an operating system setting:

Control Panel\All Control Panel Items\Ease of Access Center\Make the keyboard easier to use\Make it easier to use keyboard shortcuts\Underline keyboard shortcuts and access keys.

OTHER TIPS

Change the way the context menu is invoked. Don't show it manually, instead use something like:

textBoxSomething.ContextMenuStrip = yourContextMenuStrip;

In this case, if the user right-click on the text box (or other control you use), he will get the menu without mnemonics. But if he uses the keyboard context-menu-button to show the context menu, the mnemonics will be shown.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top