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

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

Tue Aug 11, 2020 8:14 pm

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

Wed Aug 12, 2020 10:18 am

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: 17
Joined: Mon Jun 01, 2020 11:45 am

Wed Aug 12, 2020 1:21 pm

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: 10856
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Wed Aug 12, 2020 11:18 pm

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,
Hopki
Garden Gnome Software 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