From 9420d4d1b4d324b2806073b41970c2e8ea392e37 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 31 Jan 2024 14:02:53 +0100 Subject: [PATCH] add new entry pop-up --- godot/NewEntry.tscn | 56 +++++++++++++++++++++++++++++++++++++++++++++ godot/loaded.gd | 9 ++++++++ godot/loaded.tscn | 28 ++++++++++++++++++++++- godot/project.godot | 1 + 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 godot/NewEntry.tscn create mode 100644 godot/loaded.gd diff --git a/godot/NewEntry.tscn b/godot/NewEntry.tscn new file mode 100644 index 0000000..fbc5fb8 --- /dev/null +++ b/godot/NewEntry.tscn @@ -0,0 +1,56 @@ +[gd_scene format=3 uid="uid://dutnsmmhm8px6"] + +[node name="PopupPanel" type="PopupPanel"] +size = Vector2i(100, 389) +visible = true + +[node name="GridContainer" type="GridContainer" parent="."] +offset_left = 4.0 +offset_top = 4.0 +offset_right = 96.0 +offset_bottom = 385.0 +columns = 3 + +[node name="0" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "0" + +[node name="1" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "1" + +[node name="2" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "2" + +[node name="3" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "3" + +[node name="4" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "4" + +[node name="5" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "5" + +[node name="6" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "6" + +[node name="7" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "7" + +[node name="8" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "8" + +[node name="9" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "9" + +[node name="dot" type="Button" parent="GridContainer"] +layout_mode = 2 +text = "." diff --git a/godot/loaded.gd b/godot/loaded.gd new file mode 100644 index 0000000..48ab559 --- /dev/null +++ b/godot/loaded.gd @@ -0,0 +1,9 @@ +extends VBoxContainer + +func _on_button_2_pressed(): + var p = ResourceLoader.load("res://NewEntry.tscn") + var pop_up: PopupPanel = p.instantiate() + add_child(pop_up) + #pop_up.transient = true + #pop_up.exclusive = true + pop_up.show() diff --git a/godot/loaded.tscn b/godot/loaded.tscn index 9c1ddbc..3dc91fb 100644 --- a/godot/loaded.tscn +++ b/godot/loaded.tscn @@ -1,4 +1,6 @@ -[gd_scene format=3 uid="uid://h1sdn3cjclqi"] +[gd_scene load_steps=2 format=3 uid="uid://h1sdn3cjclqi"] + +[ext_resource type="Script" path="res://loaded.gd" id="1_ntmjw"] [node name="VBoxContainer" type="VBoxContainer"] anchors_preset = 15 @@ -6,6 +8,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_ntmjw") [node name="Label" type="Label" parent="."] layout_mode = 2 @@ -30,3 +33,26 @@ text = "another one" layout_mode = 2 size_flags_horizontal = 10 theme_override_font_sizes/font_size = 1 + +[node name="PanelContainer2" type="PanelContainer" parent="."] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer2"] +layout_mode = 2 +alignment = 1 + +[node name="TextureButton" type="TextureButton" parent="PanelContainer2/HBoxContainer"] +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +size_flags_horizontal = 0 + +[node name="Label" type="Label" parent="PanelContainer2/HBoxContainer"] +layout_mode = 2 +text = "Foobar" + +[node name="Button2" type="Button" parent="PanelContainer2/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 10 +text = "+ NEW" + +[connection signal="pressed" from="PanelContainer2/HBoxContainer/Button2" to="." method="_on_button_2_pressed"] diff --git a/godot/project.godot b/godot/project.godot index d914bcb..a747d48 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -23,6 +23,7 @@ Global="*res://global.gd" window/size/viewport_width=600 window/size/viewport_height=900 +window/stretch/mode="canvas_items" window/handheld/orientation=1 [editor_plugins]