From bb0c4e302de60fb4088c572bc851fef90019c280 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Thu, 25 Aug 2022 10:11:46 -0400 Subject: [PATCH] submit form when enter is pressed --- godot/monitor/EnterButton.gd | 10 +++++++--- godot/monitor/GUI.tscn | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/godot/monitor/EnterButton.gd b/godot/monitor/EnterButton.gd index 48ed546..de051dd 100644 --- a/godot/monitor/EnterButton.gd +++ b/godot/monitor/EnterButton.gd @@ -114,6 +114,10 @@ func show_error_message(message: String) -> void: func _on_PopupDialog_gui_input(event: InputEvent) -> void: - if event.is_pressed(): - var popup = get_node("%PopupDialog") - popup.hide() + var popup = get_node("%PopupDialog") + if popup.visible and event.is_pressed(): + popup.call_deferred("hide") + + +func _on_text_entered(_new_text: String) -> void: + call_deferred("_on_Button_pressed") diff --git a/godot/monitor/GUI.tscn b/godot/monitor/GUI.tscn index 1be6fbf..c5d0203 100644 --- a/godot/monitor/GUI.tscn +++ b/godot/monitor/GUI.tscn @@ -237,9 +237,12 @@ valign = 1 autowrap = true [connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Name" to="GUI/Sounds" method="_play_ui_select_sound"] +[connection signal="text_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Name" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_text_entered"] [connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" to="GUI/Sounds" method="_play_ui_select_sound"] [connection signal="text_changed" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" to="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" method="_on_Rut_text_changed"] +[connection signal="text_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_text_entered"] [connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Email" to="GUI/Sounds" method="_play_ui_select_sound"] +[connection signal="text_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Email" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_text_entered"] [connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer3/Button" to="GUI/Sounds" method="_play_ui_select_sound"] [connection signal="pressed" from="GUI/VBoxContainer/CenterContainer3/Button" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_Button_pressed"] [connection signal="focus_entered" from="PopupDialog" to="GUI/Sounds" method="_play_popup_sound"]