Slightly better presentation for Tree.

This commit is contained in:
Nolan Darilek 2018-07-19 17:02:40 +00:00
parent 77d3ff7e44
commit 731e497ed6

View File

@ -91,10 +91,17 @@ func check_caret_moved():
print(text[pos]) print(text[pos])
old_pos = pos old_pos = pos
func render_selected_tree_item():
var item = node.get_selected()
var result = item.get_text(0)
return result
func focus_tree(): func focus_tree():
var root = node.get_root() print(render_selected_tree_item(), ": tree item")
var count = 0
print("tree: %s %s" % [count, item_or_items(count)]) func select_tree():
if node.has_focus():
print(render_selected_tree_item())
func focused(): func focused():
if node is Button: if node is Button:
@ -139,4 +146,6 @@ func _init(node):
elif node is LineEdit: elif node is LineEdit:
node.connect("text_deleted", self, "text_deleted") node.connect("text_deleted", self, "text_deleted")
node.connect("text_inserted", self, "text_inserted") node.connect("text_inserted", self, "text_inserted")
elif node is Tree:
node.connect("item_selected", self, "select_tree")
node.connect("tree_exiting", self, "free") node.connect("tree_exiting", self, "free")