# ComboBox PopupMenu Opacity

**URL:** <https://forum.juce.com/t/combobox-popupmenu-opacity/5710>\
**Category:** General JUCE discussion\
**Created:** [September 28, 2010, 1:59pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710 "2010-09-28T13:59:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![asomers](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@asomers](https://forum.juce.com/u/asomers)\
**Post date:** [September 28, 2010, 1:59pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/1 "2010-09-28T13:59:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 28, 2010, 2:32pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/2 "2010-09-28T14:32:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asomers](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@asomers](https://forum.juce.com/u/asomers)\
**Post date:** [September 28, 2010, 3:22pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/3 "2010-09-28T15:22:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 28, 2010, 3:30pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/4 "2010-09-28T15:30:05Z")

</div>

> [@asomers](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![juan1979](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@juan1979](https://forum.juce.com/u/juan1979)\
**Post date:** [January 20, 2011, 2:51pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/5 "2011-01-20T14:51:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 20, 2011, 2:58pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/6 "2011-01-20T14:58:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![juan1979](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@juan1979](https://forum.juce.com/u/juan1979)\
**Post date:** [January 20, 2011, 3:28pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/7 "2011-01-20T15:28:10Z")

</div>

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

```auto

```

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

```auto

```

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 20, 2011, 5:49pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/8 "2011-01-20T17:49:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![juan1979](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@juan1979](https://forum.juce.com/u/juan1979)\
**Post date:** [January 22, 2011, 2:09pm UTC](https://forum.juce.com/t/combobox-popupmenu-opacity/5710/9 "2011-01-22T14:09:45Z")

</div>

I understand, thanks for the nfo! 🙂
