PopupMenu subMenu L&F


#1

So I’ve got a PopupMenu with multiple subMenus…

PopupMenu mainMenu;
PopupMenu subMenu1;
PopupMenu subMenu2;

subMenu1.additem(...);
subMenu1.additem(...);
:

subMenu2.additem(...);
subMenu2.additem(...);
:

mainMenu.addSubMenu("sub1", subMenu1);
mainMenu.addSubMenu("sub2", subMenu2);

mainMenu.setLookAndFeel(m_pLook);
subMenu1.setLookAndFeel(m_pLook);
subMenu2.setLookAndFeel(m_pLook);

In the L&F I have:

const Font CPSLookAndFeel::getPopupMenuFont()
{
    return Font (12.0f);   
}

The mainMenu font size is correct (12.0), but the subMenu is the default Look and Feel font size (17.0)

Am I missing something?

Thanks,

Rail


#2

Well, all the menu windows get their L+F in the same way, from the original PopupMenu. Are you setting it via PopupMenu::setLookAndFeel() ?


#3

Ah no, hang on… Of course, you’d also need to call setLookAndFeel on all your submenus.


#4

…and thinking about it, that really shouldn’t be necessary. I’ll change it to make sure the submenus inherit their parent’s l+f. Thanks!


#5

Yeah, at first I just set the parent… since that didn’t change the subMenus I also set the submenu L&F (as in my code in the original post)… but it still doesn’t change the subMenu(s) font…???

Thanks,

Rail


#6

Try it now…


#7

It’s 6:00am – I’ll check out the tip in a couple of hours after getting a few ZZZ’s

Thanks!

Rail


#8

Works great! I just had to set the Parent L&F and the subMenus are right.

Thanks!

Rail


#9

I used to set a custom lookandfeel on submenus (in order to use a slightly different background colour for submenus, which makes them easier to read when they are drawn above a main menu), but since this change it is not working anymore . Inheriting lookandfeel is nice, but being able to specify a custom lookandfeel was a cool feature.