Game Development Community

GUI parameters

by Ted Lilljegren · in Technical Issues · 06/21/2008 (1:42 pm) · 1 replies

Just out of pure paranoia:
Currently, i can move around GUI objects and change their text values(if any) from script by just calling the objects name and the parameter EG niceButton.text = "Ama nice button click me";
But i noticed that there are also a console function that does exactly the same thing:
niceButton.setText("Ama nice button click me");

Whats up with that? Is it because I run torque in standalone mode that it allows me to change GUI parameters by simply asigning them a new value instead of calling console functions, or is it suposed to work this way?

#1
06/23/2008 (3:43 am)
Actually, this depends somewhat on the control in question. Sticking to your example, setting the text property on a GuiTextEditCtrl is semantically equivalent to calling the setText method because both are using the control's setText method. However, in the case of a GuiMLTextCtrl, the two methods are not equivalent.

I think the easiest solution is to play safe and use fields primarily for reading out values while using methods (where available) to modify a control's state. Of course, looking at the engine source code will always provide a definite answer on what's doing what.