Game Development Community

[Bug 1.1 Beta] GuiTxtCtrl & Variable are not working - LOGGED

by elvince · in Torque 3D Professional · 03/19/2010 (11:39 am) · 5 replies

Hi,

If I set the "variable" property to $Something[0].
It's not working whereas $Something[0] is clearly valued.

Did I miss something or is it a bug?

In fact, if I set this variable by script like $Something[0]="test"; nothing happen.
If I add a textEditCtrl link to this variable, then if I type something in the edit crtl, the text ctrl will show it!

Could you also confirm that only global variable can used and not variable in a namespace like $gui::variable ?

Thanks,

#1
03/19/2010 (1:33 pm)
Yes, the code here works. What does not work is using array indices. However, since TS does not have real arrays but rather fakes them, this is easy to work around.

Instead of

$Something[0]

use

$Something0
#2
03/21/2010 (2:19 am)
In fact, I tried that first before raising this thread and I didn't succeed.

After your answer I did more test and it's working but I think on the GUI editor things can be improved.

In fact, if you define $Temp="test"; in your scripts, run your game, open the gui editor, add a text ctrl and set the variable to $Temp.
close the editor (F10), and see the results... the text is empty.
F10 again, save your new GUI, quit the game, launch the game and then the text = 'Test' on your gui.

Do you think your can improve this? Because the code is working after a relaunch, and not immediately which is very confusing.
#3
08/21/2010 (8:35 am)
Feature request logged as TQA-871.
#4
09/15/2010 (1:15 am)

This is actually a bug in GuiTextCtrl::inspectPostApply which causes the value of the variable assigned to the control to be overwritten with the initial text given to the control.

Fix:

void GuiTextCtrl::inspectPostApply()
{
   Parent::inspectPostApply();
   if( mInitialTextID && *mInitialTextID != 0 )
      setTextID( mInitialTextID );
   else if( mConsoleVariable[ 0 ] )
      setText( getVariable() );
   else
      setText( mInitialText );
}

Fixed for next release (might not make it for b3, though).
#5
09/15/2010 (7:08 am)
excellent. Thanks.