How to make buttons functional for touch screen input

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Daniel Manoiu

Hello everyone. I am a total beginner to Godot and trying to figure it out while working on a quick personal project: a diabetes diet and insulin dosage calculator.

Sorry if this is a very basic question, but I’m having trouble figuring out how to make the “Button” nodes work as number inputs (touch screen). Here is a screenshot, to get an ides:

my idea is to type in the number to fill out the field, and when pressing the green check mark have the cursor move to the next field (“Line Edit” node)
been trying to use:
if $ButtonNum1.pressed:
$LineEdit.text = “1”

but this keeps overriding…

Thanks in advance for your help.

:bust_in_silhouette: Reply From: flurick

You set the text of a string directly with a “=” or “set_text(string_of_text)”,
so you could do “text = text + string_of_text” or “set_text(text+string_of_text)”

A shorter version to append text to a string is “text += string_of_text”, inside the LineEdit node there is the helper function append_at_cursor(string_of_text) that should come in handy for when you later want to be able to edit the input.