|
|
|
|
Reply From: |
codelyok13 |
There should be something like a text_changed signal for LineEdit.
Signals¶
text_change_rejected ( String rejected_substring )
Emitted when appending text that overflows the max_length. The
appended text is truncated to fit max_length, and the part that
couldn’t fit is passed as the rejected_substring argument.
text_changed ( String new_text )
Emitted when the text changes.
text_entered ( String new_text )
Emitted when the user presses @GlobalScope.KEY_ENTER on the LineEdit.
LineEdit Godot
You should have that signal run anytime a key is pressed and when the length of the text has reach 5 use the grab_focus code to move to the next line edit.
func on_LineEdit(text_changed):
if len(text) == 5: #Assumption: Code is in current LineEdit
#Called grab_focus() code for LineEdit2.
oo okay, thank you this gives me another way of thinking, using this way i need to define which lineedit i want to go next, like on every lineedit right?,
NodePath focus_next [default: NodePath(“”)]
set_focus_next(value) setter
get_focus_next() getter
Tells Godot which node it should give keyboard focus to if the user
presses Tab on a keyboard by default. You can change the key by
editing the ui_focus_next input action.
If this property is not set, Godot will select a “best guess” based on
surrounding nodes in the scene tree.
this from focus_next doc
when i click tab key, godot “guessing” which is next lineedit, and i dont need to define that like $lineedit.grab_focus(), godot like “knows” which is the next lineedit
can i just go to “next” lineedit after certain condition is true, without defining it before because it is just next to it? is that possible?
is this understandable? im sorry my poor english, but thank you
nahcode | 2022-03-11 22:04
This looks like what you are looking for but instead you want to emit ui_tab or ui_next.
Godot InputEvents
codelyok13 | 2022-03-12 03:34