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:
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.
Yes but that demo uses a JUCE menu - its a black rectangle drop-down. It doesn’t use native OSX menus at all.
But the code does ( or should ) exist in JUCE to use native menu-extras style dropdown - since I was the person who requested it ( and used it successfully until now ).
PopupMenu m;
m.addItem (1, "Quit the JUCE demo");
// It's always better to open menus asynchronously when possible.
m.showMenuAsync (PopupMenu::Options(),
ModalCallbackFunction::forComponent (menuInvocationCallback, this));
}
/////////. and this is the salient bits of mine -
void MenuExtra::timerCallback()
{
stopTimer();
showDropdownMenu(*getPopupMenu());
}
void SystemTrayIconComponent::showDropdownMenu (const PopupMenu& menu)
{
if (pimpl != nullptr)
pimpl->showMenu (menu); // this ( on 4.3 ) populates a OSX native menu using contents of ‘menu’ as template info
}
a wee thing I just noficed - in AudioPluginInstance there seems to be a void function attempting to return a value. Admittedly this is deprecated but am I missing something ?