The command shortcuts for the main menu stop working as soon as another DocumentWindow is opened and has focus.
Pressing CMD+S for example (global save command) will flash the main menu just as if the save was performed, but the command never executes.
This is reproducible in the latest PluginHost example as well. Just open the PluginHost example, then double click on any plugin you have an while that window is up and has focus you cannot press CMD+S to save the entire graph.
Once you click back onto the main window it works again.
Is this a real bug or or am I missing something obvious here? Is there a workaround?
This is really just an oddity with the plug-in host as it registers almost all of it’s commands with the window as the target. During startup, the plug-in host callscommandManager.registerAllCommandsForTarget (mainWindow); which in turn adds most of the app’s commands. Therefore, all those commands will only work when the mainWindow has focus.
Sorry Fabian, but after I moved everything to the Application class - same thing happens if another window within the app has focus. I call these during the initialization of the app. “this” is obviously the JUCEApplication class in this case.
The issue had nothing to do with registering the app as the only command target.
The problem was that the command manager KEY MAPPINGS must be added to each document window manually or the shortcuts will not work if the focused window received the keyboard shortcut.