Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 18/05/2004 15:21:58

Title: Storing a String to Update a Label
Post by: on Tue 18/05/2004 15:21:58
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.
Title: Re: Storing a String to Update a Label
Post by: Ishmael on Tue 18/05/2004 15:31:31
StrCopy might be your answer.

Also, in case you were unaware, use SetLabelText to display the text in GUI.
Title: Re: Storing a String to Update a Label
Post by: on Tue 18/05/2004 16:31:15
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 ?
Title: Re: Storing a String to Update a Label
Post by: Scorpiorus on Tue 18/05/2004 16:36:39
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.