Clicking outside component


#1

So I’ve got this little typeahead editor component. And I’d like the window showing the options menu to disappear when the user clicks outside of the TextEditor or ListBox, and/or maybe if the application loses focus.

Any ideas how to detect that?


#2

Hold that thought - just looking at the CalloutBox code…


#3

Is there a reason this function isn’t exposed in the API?
juce_areThereAnyAlwaysOnTopWindows()


#4

Also - I’ve got dismissing when the application doesn’t have focus. I can dismiss when keyboard focus moves. But how do I detect the user clicking outside the bounds of my component? Do I have to be modal for that? And if I am modal how do I pass the mouse event through?


#5

What about being a global mouse listener: http://klangfreund.github.io/jucedoc/doc/classDesktop.html#add528b1597a432f2e4cb9b10314fc210?


#6

Yep. That works :slight_smile: