Dismiss dialog by clicking outside


#1

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?

thx


#2

How about Component::focusLost()?

or TopLevelWindow::activeWindowStatusChanged()?


#3

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


#4

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


#5

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


#6

Perhaps

Component::inputAttemptWhenModal()

is what you are looking for?


#7

perfect, thanks!