ComboBox PopupMenu Opacity

Is it possible to draw a translucent PopupMenu in a ComboBox? In my look and feel, giving PopupMenu::backgroundColourId a color with alpha < 1 lightens the background but apparently does not make it translucent.

There’s certainly nothing to stop it working, though I’ve not set it up that way… I guess it’d just need tweaking so that the windows use setOpaque (false) if the background isn’t opaque, and then it should work.

Yes, calling setOpaque(false) on the Window object created in PopupMenu::createMenuComponent works, but is there a reason why this not the default setting for pop-ups?

It’s far less efficient in win32 to use a non-opaque window, so you should only setOpaque (false) if you really need the transparency.

I’m also trying to do a Popup menu transparent, but I cannot. I’m not sure if here in this thread is the solution, because it doesn’t work for me. PopupMenu::setOpaque() and PopupMenu::createMenuComponent() don’t exist. I tried also use setOpaque(false) in the component that deploy the PopupMenu (a custom button), and in the Component that contains that custom button (with is opaque with few transparent lines and components on it), but nothing.

Please, would you mind write further info about this?

All you need to do is to set PopupMenu::backgroundColourId to a semi-transparent colour, and it’ll all just work.

Yes, that was my first attempt but I obtain an interruption when I try to open the menu in juce_DropShadower.cpp:

What I did was a CustomLookAndFeel class inheriting from LookAndFeel, and then in its constructor:

I didn’t overwrite any Popup drawing method in this CustomLookAndFeel class. :?

Well, the assertion is quite right - the shadows won’t be perfect. But on windows it’s not possible to do the shadows correctly, so you can either ignore the assertion, or give up. If your colour is almost opaque, it’ll look fine.

I understand, thanks for the nfo! :slight_smile: