# Mac MainMenu: Item never enabled and always greyed-out

**URL:** <https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295>\
**Category:** MacOSX and iOS\
**Created:** [May 4, 2022, 8:41pm UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295 "2022-05-04T20:41:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamstark](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamstark/32/122_2.png) [@adamstark](https://forum.juce.com/u/adamstark)\
**Post date:** [May 4, 2022, 8:41pm UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295/1 "2022-05-04T20:41:30Z")

</div>

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:

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

```

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

```auto
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?

> [@Extra macOS menu items to respect disabled flag](https://forum.juce.com/t/extra-macos-menu-items-to-respect-disabled-flag/37276):
>
> In standalone plugins it doesn’t work: [image] This was shown from a brand new standalone plugin project, I just added MenuBarModel to the AudioProcessorEditor inheritance, minimally implemented the needed virtual functions and then did: menu.addItem(100, "Testing", false); MenuBarModel::setMacMainMenu(this, &menu); It’s certainly possible to have disabled items in this menu: [image] the last time this came up was quite some time ago : [Disable item in Mac menu](https://forum.juce.com/t/disable-item-in-mac-menu/4121) Any chance this coul…

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

Thanks,  
Adam

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [May 5, 2022, 5:09am UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295/2 "2022-05-05T05:09:01Z")

</div>

Could be related : [[BR] Alert sound selecting an item in mac menu - #3 by reuk](https://forum.juce.com/t/br-alert-sound-selecting-an-item-in-mac-menu/48066/3)

---

<div class="post-metadata">

**Author:** ![adamstark](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamstark/32/122_2.png) [@adamstark](https://forum.juce.com/u/adamstark)\
**Post date:** [May 5, 2022, 9:30am UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295/3 "2022-05-05T09:30:58Z")

</div>

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.next())
    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.

Cheers,  
Adam

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [May 5, 2022, 11:09am UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295/4 "2022-05-05T11:09:58Z")

</div>

> [@adamstark](#):
>
> Mac MainMenu

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

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 6, 2022, 9:35am UTC](https://forum.juce.com/t/mac-mainmenu-item-never-enabled-and-always-greyed-out/51295/5 "2022-05-06T09:35:02Z")

</div>

Probably a bun shortage…
