0 votes

I need a LineEdit or TextEdit as a text input for my game. As we know these two node can't handle with touchscreen events.
Therefore, I tried something like this:

func _on_TextEdit_gui_input(event):
    if event is InputEventScreenTouch:
        if event.pressed:
            print("works for TextEdit!")
            $TextEdit.cursor_set_blink_enabled(true)
            $TextEdit.set_breakpoint_gutter_enabled(true)
            print($TextEdit.is_breakpoint_gutter_enabled())


func _on_LineEdit_gui_input(event):
        if event is InputEventScreenTouch:
            if event.pressed:
                print("works for LineEdit!")
                $LineEdit.cursor_set_blink_enabled(true)
                $LineEdit.set_editable(true)
                $LineEdit.set_focus_mode(2)

I get in browser console:

works for TextEdit!
True
works for LineEdit!

But unfortunately I can't set/activate cursor in the textbox. Do you have any suggestion to solve this issue?

[EDIT]:
I also tried with OS.show_virtual_keyboard(), but nothing happends.

asked Mar 30 in Engine by SamTT (28 points)
edited Mar 30 by SamTT

1 Answer

+1 vote
answered Mar 30 by SamTT (28 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.