Game Development Community

GuiMLTextCtrl Text cut off on left during game update

by Laralyn McWilliams · in Torque Game Builder · 05/13/2010 (10:28 am) · 2 replies

I'm using a GuiMLTextCtrl. The text written to it during game start-up shows up fine:

www.eluminarts.com/images/tgb/MWSnap005.jpg
The text written to it while the game is running cuts off at the left:

www.eluminarts.com/images/tgb/MWSnap006.jpg
The same function is writing the text in both cases, concatenating the elements of a string array then sending the whole group to the GuiMLTextCtrl. Here's the relevant code (shortened because it concatenates a lot of variables):

function UpdateTextLog(%stringToEnter)
{
   for (%i = 5; %i > -1; %i--)
   {
      
      $chatLog[%i] = $chatLog[%i-1];
   }
   
   $chatLog[0] = %stringToEnter;
   DrawTextLog();
}

function DrawTextLog()
{
   GUIChatLog.setText($chatLog[0] NL $chatLog[1] NL $chatLog[2] NL $chatLog[3] NL $chatLog[4] NL $chatLog[5]);
   GUIChatLog.forceReflow();
}

Anyone know how to fix this? Thanks!

#1
05/13/2010 (1:20 pm)
I do this quite a bit in my games and have not seen this problem. I can offer a couple of suggestions.

First, try resizing the GuiMLTextCtrl to be about 20 or 30 pixels more narrow than the scroll region.

Second, if the number of lines if fixed and you don't expect the user to have to scroll, you might try getting rid of the GuiScrollCtrl completely.
#2
05/13/2010 (2:22 pm)
Resizing the GuiMLTextCtrl so it's more narrow than the scroll region did the trick. Thanks for the quick help! :-)