Hi Jules,
I like the command dispatching architecture of the ApplicationCommandManager class and I would like to use it not only for the main application commands but also for some small context menus managed by specific components.
But both the ApplicationCommandManager documentation and this forum seem to convey the idea that you can only have one instance of ApplicationCommandManager in your application.
I have derived my component from ApplicationCommandTarget and set it up to respond to a ‘cmd_TestCommand’ command, then I have tried this:
[code]void myComp::mouseDown(const MouseEvent& e)
{
if(e.mods.isPopupMenu())
{
ApplicationCommandManager acm;
PopupMenu menu;
acm.setFirstCommandTarget(this);
acm.registerAllCommandsForTarget(this);
menu.setLookAndFeel(MdLookAndFeel::instance());
menu.addCommandItem(&acm, cmd_TestCommand);
menu.show();
}[/code]
and it works perfectly. After all, I couldn’t see anything in JUCE code that should break this approach.
So my question is: am I going toward disaster by designing my code like this or not?
Thanks
