Switching between Lineedits using TAB key

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

Hello,
I have 4 Lineedits and for comfort, I would need the TAB key to be used to switch between them. But I don’t know, how do this in Gdscript.

Thanks for help!
PS: Sorry for my bad English.

:bust_in_silhouette: Reply From: njamster

If you add the LineEdit-nodes to a container, this should work out-of-the-box. If you want to tweak the behavior, you can assign the “Next” and “Previous” node manually in the property inspector for each LineEdit-node under the “Focus”-tab.

I do this, but doesn’t work it.
I add node “Container” and to it, I add my 4 nodes Lineedits as childrens.
Do I something wrong? Thanks. Eidam

Eidam | 2020-07-23 16:42

Sorry, my answer was ambiguous! While the “Container”-node obviously is a container as well, it’s special in the sense that it forms the base of all other container-nodes (i.e. all nodes displayed as direct or indirect children of the Container-node, e.g. Margin-, VBox- or GridContainer) but does not arrange it’s children by default, you need to add a script for that. If you check the scene tree, you should see a yellow exclamation mark next to the node name to inform you about this. So instead of the “Container”-node use one of its children! E.g. a VBoxContainer to stack your LineEdits vertically.

njamster | 2020-07-25 11:37