Prevent component from participating in any mouse events, specifically mouseEnter and mouseExit


When a user hovers / changes a slider control I want to dynamically display a label with the current value of the slider, but in an arbitrary position within the main parent component. I don’t want the label to participate in any mouse events, specifically from mouseEnter and mouseExit - which is what I use to decide when to display and hide the label when the mouse moves around over other slider controls. Is this currently possible?

I tried setting calling setEnabled (false) on the label but it still makes the slider control get a mouse exit event which then hides the label control, which isn’t what I want at all.

Hopefully I’m missing something obvious!


You need Component::setInterceptsMouseClicks()


Thanks, that did the trick! A bit poorly named since it has a lot more going on that just clicks, it’s all mouse events!


That name exists since the dawn of JUCE, when it probably meant exactly what it tells.

Then, it probably never got renamed to something more general, to avoid breaking existing code.

+1 for deprecating that name and replacing it with one that fits better though.