ApplicationCommandTarget not responding

Hi all,

I have a weird problem with ApplicationCommandManager/Target.

I’ve setup an ApplicationCommandmanager and a MenuBarModel in Main.cpp
My custom JUCEapplication holds an OwnedArray<DocumentWindow> and I setup commands for creating windows (cmd-N; New Window) and my custom DocumentWindow (also an ApplicationCommandTarget) has a command for deleting itself of the array (cmd-W; Close Window).

All seems to be setup correctly and is working as expected as long the DocumentWindow has setContentOwned() with a simple Hello World Component. However, as soon I use setContentOwned() with my custom ContentComponent (which is not an ApplicationCommandTarget), the close window command is not working correctly.

When I create a couple of new windows (cmd-N), the close window command is greyed out and cmd-W is not working either. But, when I close one of the windows by clicking on the close button, the rest of the opened windows receives the close window command from the ApplicationCommandManager as expected.

I suspect my ContentComponent is somehow blocking that the DocumentWindow is getting the next command target when creating a new one.

Does anybody have an idea on that?


Doh… :roll_eyes:

Self-answering my question:
one of my subcomponents was also an ApplicationCommandTarget and getNextCommandTarget() was accidentally returning nullptr instead of findFirstTargetParentComponent()

1 Like