Submenu and LookAndFeel

LookAndFeel calls drawPopupMenuItem for the main menus but not for any of their subMenus. How can I alter the drawing of a subMenu?

It calls that function to draw all items, even ones with submenus… Maybe I don’t understand your question?

The problem for the main menus in the menu bar. The LookAndFeel drawPopupMenuItem method is being called for the main popupmenus, but not for a menu item’s submenu.

Below I have commented out the default drawPopupMenuItem to show the problem.

void MyLookAndFeel::drawPopupMenuItem (Graphics &g, int width, int height, bool isSeparator, bool isActive, bool isHighlighted, bool isTicked, bool hasSubMenu, const String &text, const String &shortcutKeyText, Image *image, const Colour *const textColour)
// LookAndFeel::drawPopupMenuItem ( g, width, height, isSeparator, isActive, isHighlighted, isTicked, hasSubMenu, text, "", image, textColour);

Try this and you’ll see the submenu being drawn but not the main menu.

A picture is worth a thousand keywords…

It’s not because that function’s not working - it’ll be because the sub-menu has a different look+feel. If you’re using PopupMenu::setLookAndFeel, you’ll need to do that for each sub-menu that you create too.

Also… which build of JUCE are you using?

Jules made a change related to this - see this thread: