From 3b1d36710e253d9604b7197fba54b5840df2e2e6 Mon Sep 17 00:00:00 2001 From: tpart Date: Sun, 7 Jul 2024 15:01:02 +0200 Subject: Fix focus in setup menu --- client/menu/menu.gd | 8 ++++---- client/menu/settings.gd | 6 ++++-- client/menu/settings/settings_menu.gd | 6 ++++-- client/menu/setup.gd | 1 + 4 files changed, 13 insertions(+), 8 deletions(-) (limited to 'client/menu') diff --git a/client/menu/menu.gd b/client/menu/menu.gd index c0d0fce6..46dd7351 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -14,7 +14,7 @@ var transition: SceneTransition var parent_menu: Menu = null func _ready(): - focus_first_button(self) + focus_first(self) connect_button_sounds(self) update_parent_menu(self.get_parent()) if support_anim: anim_setup() @@ -65,14 +65,14 @@ func replace_menu(path: String): queue_free() var focus_auto_changed := false -func focus_first_button(node: Node) -> bool: +func focus_first(node: Node) -> bool: focus_auto_changed = true - if node is Button: + if node is Button or node is LineEdit: node.grab_focus() print("Node %s (%s) was selected for focus" % [node.name, node]) return true for c in node.get_children(): - if focus_first_button(c): + if focus_first(c): return true return false diff --git a/client/menu/settings.gd b/client/menu/settings.gd index 9e1b0706..c028d533 100644 --- a/client/menu/settings.gd +++ b/client/menu/settings.gd @@ -38,5 +38,7 @@ func update_rows(fix_focus = false): options.add_child(row) if fix_focus: - await get_tree().process_frame - Global.focus_first_button(self) + pass + # TODO: Not implemented! + # await get_tree().process_frame + # Global.focus_first(self) diff --git a/client/menu/settings/settings_menu.gd b/client/menu/settings/settings_menu.gd index efd462ca..1ae74910 100644 --- a/client/menu/settings/settings_menu.gd +++ b/client/menu/settings/settings_menu.gd @@ -36,5 +36,7 @@ func update_rows(fix_focus = false): options.add_child(row) if fix_focus: - await get_tree().process_frame - Global.focus_first_button(self) + pass + # TODO: Not implemented! + # await get_tree().process_frame + # Global.focus_first(self) diff --git a/client/menu/setup.gd b/client/menu/setup.gd index 80a3f6c8..9bbaf772 100644 --- a/client/menu/setup.gd +++ b/client/menu/setup.gd @@ -23,6 +23,7 @@ extends Menu func _ready(): anim.play("paper_slide") + super() func _on_sign_pressed(): var character = -1 -- cgit v1.2.3-70-g09d2