I’ve just returned to an unfinished project which last worked ( and was being worked on ) in JUCE version 4.3.1.
It used SystemTrayIconComponent to implement an OSX menu-extra dropdown menu and was all working fine. But in 5.00 the native code in JUCE seems to have been changed considerably and I get an assertion error as soon as the system tray icon is clicked.
in juice_mac-MainMenu.mm in JUCE 4.3.1 function menuNeedsUpdate() calls instance->updateMenus (menu);
but in 5.00 onwards a call is made to a new version of updateTopLevelMenu() as follows:
void updateTopLevelMenu (NSMenu* menu)
NSMenu* superMenu = [menu supermenu];
auto menuNames = currentModel->getMenuBarNames();
auto indexOfMenu = (int) [superMenu indexOfItemWithSubmenu: menu] - 1;
removeItemRecursive (menu); auto updatedPopup = currentModel->getMenuForIndex (indexOfMenu, menuNames[indexOfMenu]); for (PopupMenu::MenuItemIterator iter (updatedPopup); iter.next();) addMenuItem (iter, menu, 1, indexOfMenu); [menu update]; }
but this is generating an assertion because superMenu is nil. and thus indexOfMenu. is -1 - and because of this - the subsequent MenuBarModel method getMenuForIndex() fails.
I don’t know at this stage whether this requires a bugfix from your JUCE team or whether I need to do something different. but currently I don’t see any GUI examples in your JUCE Demo app which uses native OSX menus. For the SystemTrayIcon.
This was working in Juce 4 and is now broken in 5