Page 1 of 1

Menu accelerator issue

Posted: Tue Mar 19, 2019 10:17 pm
by Morat20
Using wxWidgets 2-9-5 (yes, I know it's old but it's what I have to work with), I seem to be running into the strangest issue with menu accelerators. Using the alt+ works, but not Ctrl+. Any menu item whose shortcut starts with "Alt" works correctly. None of the ones with "Ctrl" do. At this point, I'm certain I'm overlooking something incredibly obvious, but I can't figure it out.

file_menu = new wxMenu;
file_menu->Append(MENU_NEW, "New project\tCtrl+N");
file_menu->Append(MENU_OPEN, "Load project\tCtrl+L");
file_menu->Append(MENU_SaveInput, "Save input\tCtrl+S");
file_menu->Append(MENU_SaveInputAs,"Save input as...\tCtrl+I");
file_menu->AppendSeparator();
file_menu->Append(MENU_QUIT, "Exit\tAlt+F4");


Do I need an accelerator table for some reason?

Re: Menu accelerator issue

Posted: Tue Mar 19, 2019 10:30 pm
by doublemax
Which platform?
Did you check any of the samples that use keyboard shortcuts with "Ctrl"? E.g. the "stc" sample does.
Make a test with wx 3.x. If it works there, it means there was a bug in 2.9.5 that has been fixed by now.

Re: Menu accelerator issue

Posted: Tue Mar 19, 2019 10:41 pm
by Morat20
doublemax wrote:
Tue Mar 19, 2019 10:30 pm
Which platform?
Did you check any of the samples that use keyboard shortcuts with "Ctrl"? E.g. the "stc" sample does.
Make a test with wx 3.x. If it works there, it means there was a bug in 2.9.5 that has been fixed by now.
Windows 7, and yes the samples work. I'm at a total loss.

Re: Menu accelerator issue

Posted: Tue Mar 19, 2019 11:34 pm
by doublemax
Windows 7, and yes the samples work. I'm at a total loss.
I can't think of any obvious reason either.

I assume the event handlers work when you invoke the menu items directly?
Do you have any key event handlers?

Either try to reproduce the issue in a minimal sample or try stripping down your code until you've isolated the issue.

Re: Menu accelerator issue

Posted: Wed Mar 20, 2019 3:46 pm
by Morat20
doublemax wrote:
Tue Mar 19, 2019 11:34 pm
Windows 7, and yes the samples work. I'm at a total loss.
I can't think of any obvious reason either.

I assume the event handlers work when you invoke the menu items directly?
Do you have any key event handlers?

Either try to reproduce the issue in a minimal sample or try stripping down your code until you've isolated the issue.
Yes, direct invocation from the menu works. Replacing "Ctrl+L" with "Alt+L" works. It seems to be isolated to the use of the "Control" key, like something is catching any keyboard event that starts with "Ctrl".

Re: Menu accelerator issue

Posted: Wed Mar 20, 2019 4:42 pm
by ONEEYEMAN
Hi,
As doublemax suggested - do you have any keyboard events intercepted?
Thank you.

Re: Menu accelerator issue

Posted: Wed Mar 20, 2019 4:49 pm
by Morat20
ONEEYEMAN wrote:
Wed Mar 20, 2019 4:42 pm
Hi,
As doublemax suggested - do you have any keyboard events intercepted?
Thank you.
I'm almost certain it is being interrupted, but I've been unable to find it so far. That's the only thing I can think of to describe the problem.

Re: Menu accelerator issue

Posted: Wed Mar 20, 2019 5:00 pm
by ONEEYEMAN
Hi,
Just try to search globally for 'wxKeyEvent'...

Thank you.

Re: Menu accelerator issue

Posted: Wed Mar 20, 2019 6:58 pm
by Morat20
ONEEYEMAN wrote:
Wed Mar 20, 2019 5:00 pm
Hi,
Just try to search globally for 'wxKeyEvent'...

Thank you.
Thanks. That did it. Apparently a coworker wrote in a test function for some reason and didn't remove it or document it, and it was capturing the control events.

Thanks for the help all.