Fix the focusing errors, grab first child in TabContainer

This commit is contained in:
WallK 2024-01-11 09:20:52 +02:00
parent 5ccaee0b13
commit c429194188
3 changed files with 6 additions and 12 deletions

View file

@ -1,14 +1,7 @@
extends TabContainer
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
focusFirstFocusableChild() #grab focus on first element to enable controller focusing
func _input(event):
if (event.is_action_pressed("next_tab")):

View file

@ -1,11 +1,10 @@
extends Control
func _ready():
$MarginContainer/TabContainer/System/ScrollContainer/VBoxContainer/game_control_container/GridContainer/resume.grab_focus() #Required to enable controller focusing
var children = findElements(self, "Control")
#print(children)
for n: Control in children:
n.mouse_entered.connect(_on_control_mouse_entered.bind(n))
for n: Control in children: #iterate the children to grab focus on mouse hov
if (n.focus_mode != FOCUS_NONE):
n.mouse_entered.connect(_on_control_mouse_entered.bind(n))
func _input(event):
if event.is_action_pressed("quit"):

View file

@ -69,11 +69,13 @@ quit={
next_tab={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":69,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
previous_tab={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":81,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}