PopupMenu and mouseExit


I have a juce::Component subclass which

  1. In mouseEnter sets ‘hovered=true’ and repaints differently
  2. In mouseExit sets ‘hovered=false’ and repaints differently

and this gives me a mouse over hover effect. works great.

BUT this component also in monseDown if mods.isPopupMenu() greatest a juce::PopupMenu and does a showMenuAsync on it

Clicking on the menu or dismissing the menu never calls the mouseExit on my component. So it stays stuck in hover. I notice Pianotec does the same.

Now of course, I can use the callback of popupmenu::showAsynch to dismiss my hover also. The way my code is structured it is mildly inconvenient but totally doable. But before I do that: is there some magic I should be doing so that PopupMenu::showAsync results in a mouseExit on my component?

Thanks so much! Surge is now 100% JUCE code and life is so much better. But we are also now finding edges like this as we go so glad to have the forum here :slight_smile:


1 Like

I submitted a patch for this which fixes it for Button. But if you are using a raw Component you can try testing isBlockedByModalCompnent() to your paint along with sMouseOver() and call repaint when you display the menu I think…

I did have this working the other day :slight_smile:

The mouseExit thing is pretty annoying!


I just added an endHover to the interface I use for all my skinnable thingies, have mouseExit call endHover but then also have showMenuAsync add a [control](int i){ control->endHover();} as the second argument which fixed it. But was curious if that was dumb or necessary. Sounds like it might be a bit of both :slight_smile:

Always appreciate the fast response I get on this forum. Thank you.

MouseEnter/mouseExit calls should now be properly balanced.

Please try out this change and let us know if you encounter any new problems.

Applying this patch solves our problem yes! (It does the early end hover without me having to manually call it in the showMenuAsync).

Will take a little while for me to re-adapt surge to this working but we will add it to our list. Thank you very much!