From 9083809865719e443b8c85af0f4a517e7b2742e1 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 28 Mar 2022 16:26:50 +0000 Subject: Add title on popup control and use it to display the option sets placeholder texts. --- option_set/option_set.gd | 6 ++++-- option_set/option_set_list.gd | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'option_set') diff --git a/option_set/option_set.gd b/option_set/option_set.gd index 040566a..2ac1475 100644 --- a/option_set/option_set.gd +++ b/option_set/option_set.gd @@ -1,6 +1,8 @@ extends Control class_name OptionSet +export var placeholder: String + var text: String setget set_text, get_text func set_text(var value: String): @@ -19,7 +21,7 @@ onready var options := get_node("/root/main/option_set_list") as OptionSetList func _ready(): assert(popup != null, "OptionSet failed to get 'popup' node.") - + input.placeholder_text = placeholder input.connect("focus_entered", input, "set", ["caret_position", input.max_length]) input.connect("focus_exited", input, "deselect") @@ -34,7 +36,7 @@ func show_options(options_array: Array): else: options.unselect() options.connect("item_selected", self, "option_selected", [], CONNECT_ONESHOT) - popup.popup_control(options) + popup.popup_control(input.placeholder_text, options) # popup.connect("item_selected", self, "option_selected", [], CONNECT_ONESHOT) # popup.clear_items() # popup_opt.visible = true diff --git a/option_set/option_set_list.gd b/option_set/option_set_list.gd index 6efd068..5ebe5bf 100644 --- a/option_set/option_set_list.gd +++ b/option_set/option_set_list.gd @@ -116,6 +116,7 @@ func remove_items(indices: Array): func clear_items(): items.clear() + v_scroll_bar.value = 0.0 is_dirty = true -- cgit v1.2.3