Menu keyboard shortcuts not being invoked in the application

Hi all,

I’m having some issues on Mac with the menu bar not invoking keyboard shortcuts (although I can visibly see them picked up by the native menu with the menu title being highlighted - just nothing happens). This is in a project where it was working previously for many years and now has stopped.

The current situation is that the Component that is added to the main DocumentWindow also inherits from my custom ApplicationCommandTarget implementation, and it calls…

addKeyListener (getCommandManager().getKeyMappings());

where getCommandManager() does what it says on the tin.

However, this has ceased to work. I can get things to work when I call addKeyListener() on the actual DocumentWindow - but this is causing crashes when the window is destroyed / re-created.

Any tips on what I’m doing wrong here or what might have changed?

Thanks in advance,


I’ve sorted this now - for future readers, I needed to add the key listener to the window (as above) and to avoid the crashes I needed to make sure the ApplicationCommandManager was in my main application class (similar to the way the Projucer is implemented) so that it outlives any window - it seems to do some async stuff that assumes it isn’t deleted by the window :slight_smile: