Fix for focusing on trees with no selected items.

This commit is contained in:
Nolan Darilek 2018-07-19 20:20:48 +00:00
parent b05ad0307e
commit 140063b1a6

View File

@ -57,6 +57,9 @@ func input_item_list(event):
var text = node.get_item_text(position_in_children) var text = node.get_item_text(position_in_children)
print("%s: %s of %s" % [text, position_in_children+1, node.get_item_count()]) print("%s: %s of %s" % [text, position_in_children+1, node.get_item_count()])
func focus_label():
print(node.text)
func focus_line_edit(): func focus_line_edit():
var text = "blank" var text = "blank"
if node.secret: if node.secret:
@ -119,7 +122,10 @@ func render_tree_item():
return result return result
func focus_tree(): func focus_tree():
if node.get_selected():
print(render_tree_item(), ": tree item") print(render_tree_item(), ": tree item")
else:
print("tree")
func select_tree(): func select_tree():
if node.has_focus(): if node.has_focus():
@ -133,6 +139,8 @@ func focused():
focus_button() focus_button()
elif node is ItemList: elif node is ItemList:
focus_item_list() focus_item_list()
elif node is Label:
focus_label()
elif node is LineEdit: elif node is LineEdit:
focus_line_edit() focus_line_edit()
elif node is PopupMenu: elif node is PopupMenu: