Greyed out PopupMenu commands


#1

Hello.

I’ve started investigated the ApplicationCommandManager and associated classes . I’ve successfully added the menu, menu items and written the code for ApplicationCommandTarget, yet the menu items are greyed out and cannot seems to be activated, even with result.setActive (true); in getCommandInfo. What problems could be causing the items to be so stoically inactive?

Happy to post code, but because there’s so many bits relating to the item I though it best to be asked to specify which parts are relevant to the query.

Thank you.


#2

if the command manager can’t find the target, the items that target is responsible for will be grayed out.


#3

Indeed, I have registered the commands as per the demo:

commandManager.registerAllCommandsForTarget (&guiReceiver);

…and set in the CommandInfo:

switch (commandID)
{
case GUIReceiver::undo:
result.setInfo (“Undo”, “Reverses the previous action”, generalCategory, 0);
result.setActive (true);
result.addDefaultKeypress (‘Z’, ModifierKeys::commandModifier);
break;
{

…and have followed all the steps outlined in the ApplicationCommand Manager class guideline. Is there any way to check if or not / why the CommandManager is not finding the target?


#4

did you set a default command manager?


#5

I did. At the top of the .cpp: (part missing due to blockquote)

static ScopedPointer applicationCommandManager;

…as a class member:

ApplicationCommandManager& MainContentComponent::getApplicationCommandManager()
{
if (applicationCommandManager == nullptr)
applicationCommandManager = new ApplicationCommandManager();
return *applicationCommandManager;
}