[SOLVED] ComboBox DropDown LookAndFeel

I have a custom derived LookAndFeel_V4, which I use to style juce::PopupMenus in my GUI. To my knowledge, overriding various functions from PopupMenu::LookAndFeelsMethods is the only way to force a custom Font size onto the menu.

Ok, so far so good. Now I’m trying to incorporate the same LAF onto the menu associated with juce::ComboBox. Here’s what I’ve tried:

  1. Set on the combobox menu:
my_combobox.getRootMenu()->setLookAndFeel(&my_LAF);

This seems to have no effect, the ComboBox still uses the default LAF.

  1. Set on the Combobox directly:
my_combobox.setLookAndFeel(&my_LAF);

The menu is now completely white. No idea why this happens.

Is there a way to achieve what I’m after?

The menu will use the same lookAndFeel as the ComboBox, so I think the second option is the correct approach. I’m not sure why the menu would display completely white - this will need some debugging. If you’re not able to get to the bottom of it, please send us a minimal example and/or steps to reproduce the issue, and I’ll take a look.

1 Like

I can confirm that I can attach a more modest LookAndFeel to the ComboBox directly and it works. So the problem is likely with my derived class.

Yes, I found the problem. Completely on my side.

what i do for custom look is create a new file called lookFeel for the drawing and as a public juce::LookAndFeel_V4

then for the custom widgets ill have a file, for example CustomRotarySlider as a public juce::Slider and set the slider properties in the constructor, using setCustomLookAndFeel(&lookFeel).

for you, just use public juce::ComboBox and in your drawing file use the drawComboBox.

drawComboBox (Graphics &, int width, int height, bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, ComboBox &) override