I want key combinations Alt+L (where L is some letter) to show the first menu that begins with that letter.
So my DocumentWindow reacts to these keypresses by finding the MenuBarComponent (using dynamic_cast on child components) and calling its showMenu() method - the docs suggest this is the one to use for triggering a menu from the keyboard.
Well, this doesn’t work for me.
void MenuBarComponent::showMenu (int index)
if (index != currentPopupIndex)
My app is not in modal state so this doesn’t get executed.
indexToShowAgain = index;
After that comes some administration, deletion watchers are created and a global mouse listener is installed - which is probably fine. Then I get to this loop:
const int x = getScreenX() + xPositions [itemUnderMouse];
const int w = xPositions [itemUnderMouse + 1] - xPositions [itemUnderMouse];
and more code I don’t understand in detail, but it seems like the idea is to use the mouse position to decide which item to display - and this ends up with a DummyMenuComponent being created because the mouse is elsewhere. The index passed to showMenu() is simply ignored.
Am I supposed to put my app in modal state before calling MenuBarComponent::showMenu(), or is the method broken or am I doing things the wrong way?