Hi all, I'm trying to assign the contents of a textbox into a variable, however for some reason I just can't seem to get it to work. :( The variable will always return null/0. The code looks like it should work as far as I can see:
function tInput_OnActivate(GUIControl *control)
{
String userInput;
userInput = tInput.Text;
Display("Text is: %d", userInput);
}
I feel like the solution is probably really obvious, but I just can't figure it out. :/
When you format the string, you should use "%s", not "%d":
Display("Text is: %s", userInput);
Also, as a tip, you do not need extra variable in the example you posted, you can just do:
function tInput_OnActivate(GUIControl *control)
{
Display("Text is: %d", tInput.Text);
}
Yes, that fixed it! Thanks for the fast response. :)