system
September 20, 2018, 1:16pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
char0xff
How to disable input for a control and all its children , e.g. a PanelContainer?
Buttons and others have the member disabled , but containers don’t.
Graphically I’ve found a hack with .modulate , but regarding the input I’m lost.
system
September 22, 2018, 8:22am
2
Reply From:
hilfazer
Looks like you can’t, this feature was requested on github:
opened 10:45PM - 17 Jul 18 UTC
closed 06:58PM - 27 May 20 UTC
feature proposal
archived
topic:gui
Godot 3.0.5
I've been several times in the situation where I wanted to animat… e a GUI window while it opens or closes. The problem is, when the animation play, I don't want the window or any of its children to be interactive. If it was, an unfortunate double-click could trigger a child control during the animation, leading to unwanted game state.
Disabling all widgets in the window would be messy, because you might need that state set for other reasons and it changes how controls look.
Then, so far I've been solving this problem by placing an occluder control on top of it to block mouse clicks, but I feel it's not as easy as it should be, and it has complications for example when the parent is a container (would mess with anchors, requiring additional setup).
Another case is when doing an animated pause menu. With a blocking control on top of the window, I cannot get input to work in the game until the animation completely hides it (because I am correctly using `_unhandled_input`), but in that case I want game input to start working immediately as if the menu was ignoring all input.
It also doesn't take care of keyboard input, although a script could clear the focus.
I tried changing `mouse_filter`, but this one only affects the control and not its children. I would like to basically have that working with the following options:
- block the event and ignore children
- ignore it and also ignore children