Submenu and LookAndFeel


#1

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


#2

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


#3

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.


#4

A picture is worth a thousand keywords…


#5

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.


#6

Also… which build of JUCE are you using?

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

http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=9880

Rail