I suspect a bug when using a custom callback with an item of a SubMenu, on Mac. The item is well displayed but when clicked, the callback is not called. However, it ONLY happens when the MenuBarModel::setMacMainMenu is used with the menu as a parameter. When it is NOT applied, the menu item works fine. Is it a bug? On Windows and Linux, everything is fine.
Please check the develop trunk. There used to be a bug which has been fixed a month ago.
Not sure if this really your issue as it was the main menu but just in case.
Thanks for your answer. However, I tested on the latest version of JUCE on both master and develop, and it does not work: the callback is not called. if setMacMainMenu is used.
Thanks for reporting. This is fixed on develop with commit e0b0920.
It turns out that by fixing this bug we discovered a memory-leak (as PopupMenu::CustomCallback has a leak detector) for any native macOS menu item that JUCE creates. It took ages to figure out what the problem was but it’s finally fixed - also on develop -
with commit 6ae99f4.