Mac MainMenu: Item never enabled and always greyed-out

Hi there,

We have a Mac main menu item which has been working for years but after recent JUCE updates it is now never enabled, even though we are setting it to be active in the ApplicationCommandTarget::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) callback:

case preferences:
            result.setInfo ("Preferences", "Load the preferences panel", "Category Name", 0);
            result.setTicked (false);
            result.setActive (true);
            result.addDefaultKeypress (',', ModifierKeys::commandModifier);

This is how we add the item (elsewhere in our codebase):

PopupMenu extraAppleMenuItems;
extraAppleMenuItems.addCommandItem (&commandManager, preferences);
MenuBarModel::setMacMainMenu (this, &extraAppleMenuItems);

To be clear - the menu item shows up, but it is greyed out. All other menu items (in non-Apple File, Edit, etc menus) work as normal.

Could it be something to do with this recent change?

In particular, my tests indicate that the validateMenuItem() function in is never called for this Mac main menu item, but is called for all other menu items.


Could be related : [BR] Alert sound selecting an item in mac menu - #3 by reuk

Yes, I think it might be. I managed to get it working doing this:

PopupMenu extraAppleMenuItems;
extraAppleMenuItems.addCommandItem (&commandManager, preferences);

PopupMenu::MenuItemIterator iterator (extraAppleMenuItems, false);

while (
    iterator.getItem().setEnabled (true);

MenuBarModel::setMacMainMenu (this, &extraAppleMenuItems);

But definitely the command item is not being listened to with respect to its enabled/active state.


1 Like

:hamburger: ← this is what I pictured in my mind before making sense of the context. Please tell me I’m not alone


Probably a bun shortage…