How to prevent clicking "through" or "behind" a dialog?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Losatu

I am using dialogs (Popup or WindowDialog) and have a problem that on popup the elements which are behind a dialog are clickable as there would be no dialog.

So my question is: is there a simple way to change this behaviour, so nothing behind a dialog would be clickable?

At the moment I thinking to create a workaround: on popup make all elements not relavant for the popup be unclickable and on close reable them all again…

Other possible solution might be to find a container, which can not be clicked through (if there is such) and place it behind the popup…

I feel like there must be a simpler solution.

:bust_in_silhouette: Reply From: Yuminous

Maybe you’re looking for the Popup > Exclusive option?

It disallows clicking outside of the dialog while it is popped-up.

You are right and this seems to work for all but not for “TouchScreenButton”. If it is behind, it will still be clicked…

Losatu | 2021-07-21 10:35

TouchScreenButton isn’t a Control node, so unfortunately it can’t be affected in the same way.
Perhaps you could hide them? Child them all under a node and hide() it when you call popup().

If you still need them to look “visible” but not function you could have a Sprite underneath them, which you could basically set as a screenshot of the buttons before they were hidden.

Yuminous | 2021-07-21 11:35

I am lucky having them invisible, so I hide and show them again. This is a workaround for now. Thank you.

Losatu | 2021-07-21 12:09