Remove need for custom signal.

This commit is contained in:
Nolan Darilek 2018-06-18 20:33:03 +00:00
parent 6d1d0f914e
commit 9899940106

View File

@ -33,12 +33,17 @@ func present_line_edit():
type = "text"
print("%s: %s" % [text, type])
func caret_moved():
var old_pos
func check_caret_moved():
var pos = node.caret_position
if old_pos != pos:
var text = node.text
if pos > len(text)-1:
return
print("blank")
else:
print(text[pos])
old_pos = pos
func present_tree():
var root = node.get_root()
@ -61,7 +66,8 @@ func unfocused():
pass
func gui_input(event):
pass
if self.node is LineEdit:
check_caret_moved()
func _init(node):
if node.is_in_group("accessible"):
@ -74,6 +80,4 @@ func _init(node):
self.node.connect("focus_exited", self, "unfocused")
self.node.connect("mouse_exited", self, "unfocused")
self.node.connect("gui_input", self, "gui_input")
if self.node is LineEdit:
self.node.connect("caret_moved", self, "caret_moved")
self.node.connect("tree_exiting", self, "free")