LookAndFeel::getParentComponentForMenuOption and submenus



If I create a PopupMenu with its options.parentComponent being null, but with a custom LookAndFeel::getParentComponentForMenuOption method that returns a non-null component to act as the parent of my PopupMenus, that component is not applied as a parent to the submenus, only to the main PopupMenus.

Fix: add this line in juce_PopupMenu.cpp:

parentComponent = lf.getParentComponentForMenuOptions (options);

+ const_cast<Options&>(options) = options.withParentComponent(parentComponent);

if (parentComponent == nullptr && parentWindow == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options))


Thanks. I’ll get that added shortly.