# BUG?: Custom popup item not working after JUCE 6.1.5

**URL:** <https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394>\
**Category:** Development\
**Created:** [May 11, 2022, 2:30am UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394 "2022-05-11T02:30:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yosogawa](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yosogawa](https://forum.juce.com/u/yosogawa)\
**Post date:** [May 11, 2022, 2:30am UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/1 "2022-05-11T02:30:24Z")

</div>

Hi!  
The following article fixes “custom popup on macOS”, but I also encountered it on Windows with JUCE 6.1.6. Will there be any modifications to windows or other platforms?

> [@Custom popup item not working on Mac since updating to JUCE 6](https://forum.juce.com/t/custom-popup-item-not-working-on-mac-since-updating-to-juce-6/50099):
>
> Hi, I have a custom label component which I am adding to a popup menu via addCustomItem(). Up till now, I have been able to open the popup menu and edit the label, but recently I’ve discovered that this feature is now broken and while I can make the label editable, there is no cursor and entering text does not work. I have overridden textEditorTextChanged() and editorShown() to confirm that the editor is being shown but the text editor is not accepting any input. I looked through repo commits …

---

<div class="post-metadata">

**Author:** ![yosogawa](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yosogawa](https://forum.juce.com/u/yosogawa)\
**Post date:** [May 11, 2022, 7:42am UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/2 "2022-05-11T07:42:22Z")

</div>

![customMenu](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/3ae8a84fcd905039664a91ace44fadbd9c2219b8.png)  
checked DemoRunner, Windows/VS2017 build.

---

<div class="post-metadata">

**Author:** ![aguy-PG](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aguy-PG](https://forum.juce.com/u/aguy-PG)\
**Post date:** [May 16, 2022, 8:41pm UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/3 "2022-05-16T20:41:25Z")

</div>

I’ve not had any issues with custom popup items on Windows. I am currently running JUCE 6.1.6 and the Custom items button in the DemoRunner works as expected. If you want to provide a simple code example example I can better understand what you’re trying to do.

---

<div class="post-metadata">

**Author:** ![yosogawa](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yosogawa](https://forum.juce.com/u/yosogawa)\
**Post date:** [May 17, 2022, 11:30pm UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/4 "2022-05-17T23:30:50Z")

</div>

I will explain it a little more carefully.

In my environment (though I don’t think there is a difference)  
When I created an Item with PopupMenu :: addCustomItem (), that Item was no longer selected.  
Instead, I created a simple Item with only a string without an image with PopupMenu :: addItem (), and now I can select it.

In the case of DemoRunner, if you click the colored part and PopupMenu does not close, there is a problem, and if PopupMenu closes, there is no problem.

In my code, the result was the same whether I checked with the return value of showAt () / show () with JUCE\_MODAL\_LOOPS\_PERMITTED = 1 and received it with a lambda expression with JUCE\_MODAL\_LOOPS\_PERMITTED = 0.

PopupMenu is generated in the mousedown method of other Component.

---

<div class="post-metadata">

**Author:** ![aguy-PG](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aguy-PG](https://forum.juce.com/u/aguy-PG)\
**Post date:** [May 25, 2022, 11:17pm UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/5 "2022-05-25T23:17:49Z")

</div>

Again, it would be helpful if you could post of a code example of how you are using the PopupMenu component. This way I could understand why it is not working correctly for you.

Take a look at the documentation for `PopupMenu::addCustomItem()`. There is a parameter called `triggerMenuItemAutomaticallyWhenClicked` which when set to TRUE will close the popup menu after being clicked. Without looking at the JUCE demo for this, I assume that this parameter was set to false which prevents the popup menu from being closed when the colored part is clicked.

By design, a custom component in a PopupMenu will not be highlighted or selected like regular menu items. The solution to this which I have done in my project is to implement the behavior you want to see in your custom component by overriding class functions like Component::paint(), Component::mouseOver(), Component::mouseDown(), etc. For instance, if you want your custom component to be highlighted when the mouse is over it, then you can override Component::mouseOver(), Component::mouseExit(), and Component::paint() and set a variable to store when the mouse is over the component, then repaint the component according with the highlight color.

Hopefully this clears things up a bit for you!

---

<div class="post-metadata">

**Author:** ![yosogawa](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yosogawa](https://forum.juce.com/u/yosogawa)\
**Post date:** [May 26, 2022, 12:56am UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/6 "2022-05-26T00:56:42Z")

</div>

@aguy-PG thank you, resoponse.

I’ve been using the first PopupMenu :: addCustomItem () for those who don’t use triggerMenuItemAutomaticallyWhenClicked since JUCE ver2 (to be exact, written by my project’s predecessor). There is one that uses, such as example / GUI / WidgetDemo.h: Line592.  
This was the same behavior he had until JUCE2. \* … JUCE6.1.4, but when I raised JUCE to 6.1.5, 6.1.6 he was no longer triggered by clicking the mouse.  
If the specs changed in 6.1.5, I think the demo needs to be rewritten as well.

---

<div class="post-metadata">

**Author:** ![aguy-PG](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aguy-PG](https://forum.juce.com/u/aguy-PG)\
**Post date:** [May 26, 2022, 3:28pm UTC](https://forum.juce.com/t/bug-custom-popup-item-not-working-after-juce-6-1-5/51394/7 "2022-05-26T15:28:28Z")

</div>

I see, this is a separate issue from my original post. I would suggest reaching out to the JUCE team directly to get them to take a look if this is the case. I think it may resolve your specific issue to use the second definition of PopupMenu::addCustomItem() because of this reason. It would not be a big change for you seeing as the second definition contains all the same parameters as the first, but includes the additional parameters that will resolve your issue.
