editing text in a text field or text area

hi all…

first of all, would like to thanks those forum members that have helped me with my newbee questions…

here’s another one :slight_smile:

I just managed to insert a textfield through my script and I’m having some trouble in changing it’s default text value… meaning, I can select it but can’t actually write any new text in it…

thank you all, once again :wink:

here’s the code:

// ########## my main .js file ############
function OnGUI () {
	
	var janelaParedes: Rect = Rect (Screen.width / 2 - 200 ,Screen.height / 2 - 150, 400, 300);
	var janelaParedes1: Rect = Rect (Screen.width / 2 - 200 ,Screen.height / 2 - 150, 400, 300);

	if (doWindow0)
		janelaParedes = GUI.Window (0, janelaParedes, DoWindow0, "Criar Paredes - Escolher Opcao");
	
	if (doWindow1) {
		janelaParedes1 = GUI.Window (1, janelaParedes1, DoWindow1, "Wizard para layout de paredes");
		WizardQuatroParedes.CriarWizard();
	}
	
	if (GUI.Button(Rect (10, 10, 100,30), "Criar Paredes")){
		if (doWindow0 == true) {
			doWindow0 = false;
		} else {
			doWindow0 = true;
		}
	}
	
}



// ########## my WizardQuatroParedes.js file ############

static function CriarWizard()
{
		
	var textAreaString = "text area";

	textAreaString = GUI.TextArea(new Rect (120, 10, 200, 100), textAreaString, 160);
	
	if (GUI.TextArea.changed) {
		textAreaString = GUI.TextArea.text;
	}

}

you problem is that you don’t store the text in the field in a variable that survives the function call, as such its always reset again

changed my code… it’s like this now, and it works :wink:

thanks dreamora

// ########## my WizardQuatroParedes.js file ############

static var textAreaString = "text area";

static function CriarWizard()
{
  textAreaString = GUI.TextArea(new Rect (120, 10, 200, 100), textAreaString, 160);

}