Why does ApplicationCommandTarget::perform() not work without info?


Hi all,

I have a MenuBarModel and ApplicationCommandTarget. I'd like all commands to be visible in the menu, even is the current target cannot use them. Because some targets are not instantiated right from the start, that means I cannot use ApplicationCommandManager::registerAllCommandsForTarget() and need to register all commands in one place (my main controller).

It seems redundant to have ApplicationCommandTarget::getCommandInfo() fill in the struct with exactly the same information I register a command with in my main controller, but apparently ApplicationCommandTarget::perform() will not be called if I don't do this. I don't like the redundancy and double work here; it seems as if I'm doing something wrong.

What would be the best solution here? Perhaps I'm just working against JUCE's ideal architecture and I just can't see it.

Any help is much appreciated.



You doesn't/shouldn't need to modify Juce own source code, you need to subclass Juce LnF to do your own




Hi Otristan,

Thanks very much for your reply. Yet - and I am in no way trying to be offensive and correct me if I'm wrong - it doesn't seem you read my post that well. I'm not looking to address look and feel of either the menu or command manager, but asking about a behavioural change. I am also very well aware of what polymorphism and inheritance are (one could not use JUCE without).

I'm already inheriting from ApplicationCommandTarget. The problem is that one can only register their commands when an object of this class is instantiated and in my application this doesn't happen until very late in the app's lifecycle. Still, I'd like all commands to be visible in the menu from start, albeit greyed out.