Retrieve the Text, from a Text Box, to set a variable

Q&A about the latest versions
Post Reply
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Hello,

I have a question. I do not have much knowledge about Java sorry.

How can I retrieve the active text, from a text box, to set it in a variable.
The text changes depending on mouse clicks and I want to reuse that text for another action. The idea is a variable that takes the value of the text.

I am sure there is a placeholder $(*...) that returns the text.

If the text box is called "TEXT1" for example. How the placeholder would be?.

Thank you very much for your help
Josh
Posts: 11
Joined: Wed Aug 05, 2020 1:54 pm

Hi,

I'm not sure about reading the text into a variable, but you can put text from a variable into a text object using the "Set Value" action. So, in terms of what you're trying to achieve let's say there is one text box (text), two buttons (button1 & button2), and two text variables that contain your text (var1 & var2).

You'd set button 1 to have an action: Source=Mouse Click, Action=Set Value, Value=$(*var1), Target=text.
You'd set button 2 to have an action: Source=Mouse Click, Action=Set Value, Value=$(*var2), Target=text.

Clicking on either of these buttons with change out the text shown to the user. If you want the text box to say something before the buttons are clicked simply pop one of the variables in the text box in the skin editor.

Hope this helps you out, good luck.

J
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Thanks for your reply Josh.

But the idea is more or less the oposit. Take the text, from a text box, and put it into the variable.

Text box, text ="hello"
Variable A = "hello"

Text box, the text changes to text="bye"
Variable A = "bye"

And so on
User avatar
Hopki
Gnome
Posts: 13027
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
You would use the Text box to display the variable, then set the variable to change it.
Mouse Click, Set Variable Value, new text, Text variable.
The text box just displays the text in the variable.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply