+1 vote

I have a tab manager with several tabs, some of the receive user keyboard inputs.

How do I block the tabs that aren't active to receive inputs? Is there a simple way to check if the node is active in the tab manager?

Godot version 3.4.stable
in Engine by (21 points)

1 Answer

0 votes

Every Control Node tries to consume _inputs. To interact with things inside each tabs, I recommend to use nested unhandled input like this hierarchy

Tabs
    Tab1 - _unhandled_input()
        Item1 - _unhandled_input()

Then you can prevent parent Nodes from consuming inputs. If parent nodes consume inputs, _unhandled_inputs will not be triggered.

Set Every control node's (including parent) "mouse_filter" property to 2 (Ignore) to make parent nodes not to consume inputs. or you can code like this:

ControlNode.set_mouse_filter(2)

set 'activated' variable on each tab manager. initial value to false. And make active tab's 'activated' variable to true.

put next code to every tabs.

_unhandled_input(event):
    if activated == true:
        do something here

It will solve the problem.

by (236 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.