Use text_inserted and text_deleted signals.

This commit is contained in:
Nolan Darilek 2018-07-03 15:45:31 +00:00
parent 9899940106
commit 9b3c1e6f38

View File

@ -33,6 +33,12 @@ func present_line_edit():
type = "text" type = "text"
print("%s: %s" % [text, type]) print("%s: %s" % [text, type])
func text_deleted(text):
print("%s deleted" % text)
func text_inserted(text):
print(text)
var old_pos var old_pos
func check_caret_moved(): func check_caret_moved():
@ -80,4 +86,7 @@ func _init(node):
self.node.connect("focus_exited", self, "unfocused") self.node.connect("focus_exited", self, "unfocused")
self.node.connect("mouse_exited", self, "unfocused") self.node.connect("mouse_exited", self, "unfocused")
self.node.connect("gui_input", self, "gui_input") self.node.connect("gui_input", self, "gui_input")
if self.node is LineEdit:
self.node.connect("text_deleted", self, "text_deleted")
self.node.connect("text_inserted", self, "text_inserted")
self.node.connect("tree_exiting", self, "free") self.node.connect("tree_exiting", self, "free")