![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | SamTT |
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.