Storing a String to Update a Label

Started by , Tue 18/05/2004 15:21:58

Previous topic - Next topic

AGS Newbie

Hi, everyone. I've been exploring through various ways to actually accomplish it, but I keep turning up short. I'd like to store a string in a variable, opposed to the buffer, so that it can actually be outputted to a label for GUI display. The string I want to capture is from a text box on a GUI, opposed from using InputBox. I'd like to capture the string that the user enters ( For example: name, age, etc. ) and transfer the value to be displayed on-screen, through the use of another GUI and label.

I've tried using GetTextBoxText, SetGlobalString and more, but these only seem to capture to the buffer, or the value returned through a text box but these don't seem to allow me to store the string for ease of use.

Thanks.

Ishmael

StrCopy might be your answer.

Also, in case you were unaware, use SetLabelText to display the text in GUI.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

AGS Newbie

Thanks for the quick response. However, according the manual StrCopy will allow me to transfer a string of characters, for example, " This is a message " into a variable (string) called "message".

I would like to transfer the inputted string from the user in the text box into the variable directly, or at least be able to transfer the value into a label onto another GUI to be displayed. The user must supply the value to be stored and then displayed, opposed to defining it myself. Can you provide an example ?

Scorpiorus

#3
Well, the GetTextBoxText fills the buffer string you pass into it, thus you can use that buffer string to set a label text or whatever:

string buffer; //declaring buffer variable of string type

GetTextBoxText (<gui1>, <object1>, buffer); // fill it up with what is in the textbox

SetLabelText (<gui2>, <object2>, buffer); // use the content of buffer to set label's text

EDIT: the difference between these two commands is that the first command copies a textbox text into the buffer whereas the second one copies from the buffer into label.

SMF spam blocked by CleanTalk