Dismiss dialog by clicking outside


Hi, I’m looking for some behaviour where I want to pop up a window and have it essentially modal, but be able o register a click outside the window in order to dismiss it.

Anyone any tips on how to achieve?



How about Component::focusLost()?

or TopLevelWindow::activeWindowStatusChanged()?


focusLost() is no good as the window is modal so the click is getting blocked somewhere…


Override mouseDown and check if the modal component contains the point - I’ve done something similar in the app I’m currently working on.


hi, tried that but mouseDown() is also not being called.




is what you are looking for?


perfect, thanks!