Best method for dismissible Component? Perhaps a Feature Request

Quite often I want some component that appears on top of my existing UI, that I would like to dismiss when a click is happening outside of the pop-over component. I don’t want to use a transparent Component covering the whole UI, as I would like clicks on other UI items to register even if the pop-over is visible (but have the pop-over hide itself when this happens).

Is there some simple way to achieve this that I have overlooked?

If there were a mouseClickOutside virtual method in Component, it could simplify things enormously for me.

Maybe you could use a global mouse listener and check if the clicked component was NOT the popup. You can add it add a global mouse listener to the Desktop singleton. See: https://docs.juce.com/master/classDesktop.html#add528b1597a432f2e4cb9b10314fc210

1 Like

How about a CallOutBox?
https://docs.juce.com/master/classCallOutBox.html

Matt

4 Likes