# Menu selection disko in PT

**URL:** <https://forum.juce.com/t/menu-selection-disko-in-pt/27332>\
**Category:** General JUCE discussion\
**Created:** [April 20, 2018, 1:49pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332 "2018-04-20T13:49:38Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 30, 2018, 11:42am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/21 "2018-04-30T11:42:38Z")

</div>

Just tried the separators: no difference. Have you been able to reproduce it with my code?

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [April 30, 2018, 6:27pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/22 "2018-04-30T18:27:54Z")

</div>

I saw it happen once – but I’m going to try modifying it so it’s closer to mine to see if I can get it to happen more reliably.

Rail

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [April 30, 2018, 7:18pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/23 "2018-04-30T19:18:27Z")

</div>

Try this:

> **[AudioPluginDemo.h](https://www.dropbox.com/s/o3scnmukdfw6fqo/AudioPluginDemo.h?dl=0)**
>
> Shared with Dropbox

Rail

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 1, 2018, 9:14am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/24 "2018-05-01T09:14:25Z")

</div>

Sorry still can’t reproduce this. It must be a subtle race condition. I’ve tried reproducing this in Reaper, Logic Pro, Ableton Live and ProTools. I tried it on retina screens and non-retina, with large menus and small menus. Just can’t get it to happen here. I’m sure it’s a JUCE issue it’s just impossible to narrow down without it happening on my machine.

 ![NoMenuDisco](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/f/f61020f8e0246f2e72ba561807fe9e40e42f72ff.gif)

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 1, 2018, 10:23am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/25 "2018-05-01T10:23:41Z")

</div>

It happens when you move the mouse over the parents (not the children). Sometimes you’ll even get into a condition where if you’re between parents the child PopupMenu will flash on and off. Clicking on any parent ‘fixes’ it.

Are you testing a debug or release build? It may be more apparent in a Release build (the children are pretty slow to show on my iMac 3.4GHz i7 w/ 32GB RAM).

Rail

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 1, 2018, 10:33am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/26 "2018-05-01T10:33:39Z")

</div>

Hmmm I tried release, tried only the parent items, added a hundred submenu items. I still can’t reproduce this. I know it’s a lot of work, but I looked at the commits which could have potentially caused this bug and found the following commits. Can you try reverting the commits and see which one broke the menu behaviour for you:

[http://github.com/WeAreROLI/JUCE/commits/ff474962fd302e3ec2568632045b7b4a7b960e3f](http://github.com/WeAreROLI/JUCE/commits/ff474962fd302e3ec2568632045b7b4a7b960e3f)  
[http://github.com/WeAreROLI/JUCE/commits/31e454f284b1b1ee4d91d22048f17020b8f00f87](http://github.com/WeAreROLI/JUCE/commits/31e454f284b1b1ee4d91d22048f17020b8f00f87)  
[http://github.com/WeAreROLI/JUCE/commits/9e356135a1afea04e1e1e975a3504173345fec7b](http://github.com/WeAreROLI/JUCE/commits/9e356135a1afea04e1e1e975a3504173345fec7b)  
[http://github.com/WeAreROLI/JUCE/commits/9f4648f85689ee5862291d57917a417a4613ef51](http://github.com/WeAreROLI/JUCE/commits/9f4648f85689ee5862291d57917a417a4613ef51)  
[http://github.com/WeAreROLI/JUCE/commits/b574d4530ead35b8392cbc94310fd83e19e31f51](http://github.com/WeAreROLI/JUCE/commits/b574d4530ead35b8392cbc94310fd83e19e31f51)  
[http://github.com/WeAreROLI/JUCE/commits/35b08ecec2e4e493cf5154f7ee579fb52c659175](http://github.com/WeAreROLI/JUCE/commits/35b08ecec2e4e493cf5154f7ee579fb52c659175)  
[http://github.com/WeAreROLI/JUCE/commits/2483c80529433b07498630bbde29ad4cfb8f337d](http://github.com/WeAreROLI/JUCE/commits/2483c80529433b07498630bbde29ad4cfb8f337d)  
[http://github.com/WeAreROLI/JUCE/commits/f866b4ff5e6269eb39fe59d022730f26b5ed57d8](http://github.com/WeAreROLI/JUCE/commits/f866b4ff5e6269eb39fe59d022730f26b5ed57d8)

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 1, 2018, 10:36am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/27 "2018-05-01T10:36:22Z")

</div>

I’ll make time tomorrow (later today) to try and step backwards through the commits to see if I can isolate the commit that caused it (if it exists).

Thanks,

Rail

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 1, 2018, 10:42am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/28 "2018-05-01T10:42:13Z")

</div>

Probably completely unrelated, but since it happens unreliably, maybe there are mouse events happening, that are jumping because of dust in the optics or alike? So that the flickering could be expected?  
Just a thought…

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 1, 2018, 10:47am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/29 "2018-05-01T10:47:07Z")

</div>

I don’t think so – I tested an old build of my plug-in which was built with JUCE 4.x and I don’t see the same issue.

Cheers,

Rail

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 1, 2018, 10:48am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/30 "2018-05-01T10:48:27Z")

</div>

Sounds plausible, just wanted to rule out side effects…  
Cheers!

---

<div class="post-metadata">

**Author:** ![raketa](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/raketa/32/1725_2.png) [@raketa](https://forum.juce.com/u/raketa)\
**Post date:** [May 1, 2018, 10:54am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/31 "2018-05-01T10:54:36Z")

</div>

No, I can reliably reproduce it here.

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 1, 2018, 10:57am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/32 "2018-05-01T10:57:33Z")

</div>

> [@raketa](#):
>
> No, I can reliably reproduce it here.

Out of interest - what size is your Screen and what resolution are you running?

Cheers,

Rail

---

<div class="post-metadata">

**Author:** ![raketa](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/raketa/32/1725_2.png) [@raketa](https://forum.juce.com/u/raketa)\
**Post date:** [May 2, 2018, 4:26am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/33 "2018-05-02T04:26:56Z")

</div>

Its 2560 x 1440, non-retina (but reports probably have a different resolution).

---

<div class="post-metadata">

**Author:** ![amusesmile](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/amusesmile/32/681_2.png) [@amusesmile](https://forum.juce.com/u/amusesmile)\
**Post date:** [May 4, 2018, 5:50pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/34 "2018-05-04T17:50:36Z")

</div>

Hey just to give more information about this- I think it has to do with the window not getting system focus or a race condition where focus stays on the previous window. I’ve seen similar issues in Swift when trying to create dynamic popups and this would explain what’s going on. When the sub-menu windows are removed the OS is trying to give focus back to the previously selected window and if that hasn’t been established as the right one then everything gets screwy. The video should explain it more clearly than I can do with text: [https://www.youtube.com/watch?v=hGyfehHY5r8](https://www.youtube.com/watch?v=hGyfehHY5r8)

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 5, 2018, 7:17am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/35 "2018-05-05T07:17:39Z")

</div>

Okay… This is the commit which causes the flashing…

[https://github.com/WeAreROLI/JUCE/commit/7d98da98ea4ea811ca5b0bc4ca315b95d9bfc0d1](https://github.com/WeAreROLI/JUCE/commit/7d98da98ea4ea811ca5b0bc4ca315b95d9bfc0d1)

I had to change the code for the older commits (and also added more menu items to exacerbate the issue):

> **[AudioPluginDemo.h](https://www.dropbox.com/s/3nayc9j4q1y2jj7/AudioPluginDemo.h?dl=0)**
>
> Shared with Dropbox

Rail

---

<div class="post-metadata">

**Author:** ![raketa](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/raketa/32/1725_2.png) [@raketa](https://forum.juce.com/u/raketa)\
**Post date:** [May 7, 2018, 1:13pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/36 "2018-05-07T13:13:01Z")

</div>

Thanks, @Rail_Jon_Rogut for your investigation!

@Roli: will we see a fix and when?  
_(I am asking because we are coordinating releases here and we need to decide if we have to apply our own fix to your framework. So an answer, that does not take a month is highly appreciated.)_

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 8, 2018, 8:48am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/37 "2018-05-08T08:48:28Z")

</div>

We’re working on it…

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 8, 2018, 10:01am UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/38 "2018-05-08T10:01:25Z")

</div>

OK the commit was used for this bug:

> [@Tooltips sometimes drawing out in left field](https://forum.juce.com/t/tooltips-sometimes-drawing-out-in-left-field/23942):
>
> Using a TooltipWindow without a parent component, we often observe the following: A tooltip is shown on top of our plugin UI (as expected, so far so good) The mouse is moved quickly outside of the plugin UI A new tooltip appears, sometimes even on a secondary display, for the last component the mouse traversed over. That last-traversed component still appears hovered-over, although the mouse is far far away. In many cases, the tooltip (and mouse cursor) is \>1000px from our plugin UI and from a…

I think the following patch fixes both but as I can’t reproduce the menu disco bug, can someone check if this patch actually fixes it:

[FixMenuDisco.patch](https://forum.juce.com/uploads/short-url/60Wcjtc8pnENp9jDeuKImQHt6mz.patch) (2.7 KB)

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [May 8, 2018, 1:17pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/39 "2018-05-08T13:17:50Z")

</div>

Unfortunately that still causes flashes in a random parent when hovering over the parents in the PopupMenu… unless you click on any parent.

Thanks,

Rail

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 8, 2018, 1:19pm UTC](https://forum.juce.com/t/menu-selection-disko-in-pt/27332/40 "2018-05-08T13:19:18Z")

</div>

Damn… ok thank you. I’ll have to rethink this one.

[Previous page](https://forum.juce.com/t/menu-selection-disko-in-pt/27332.md?page=1)

[Next page](https://forum.juce.com/t/menu-selection-disko-in-pt/27332.md?page=3)
