Game Development Community

GuiTextListCtrl drops last TAB item

by Ronald J Nelson · in Torque Game Engine Advanced · 05/25/2008 (7:46 pm) · 3 replies

I am seeing a bug in multiple places in my game for the GuiTextListCtrl. If it is updates only once, it will drop off the far right value. If it is updated more than once it appears. So in cases like my playerlist gui it is barely noticeable. But in the end game gui you can see it clearly.

Here is my gui script:

new GuiTextListCtrl(EndGameGuiList) {
            canSaveDynamicFields = "0";
            Profile = "GuiTextArrayProfile";
            HorizSizing = "relative";
            VertSizing = "relative";
            position = "2 2";
            Extent = "304 8";
            MinExtent = "8 8";
            canSave = "1";
            Visible = "1";
            hovertime = "1000";
            enumerate = "0";
            resizeCell = "1";
            columns = "0 162 213 268";
            fitParentWidth = "1";
            clipColumnText = "0";
         };

Here is my script to load the values:
function EndGameGui::updateDMGameEndScore(%this, %clientId, %name, %kills, %deaths, %score )
{
   %text = StripMLControlChars(%name) TAB %kills TAB %deaths TAB %score;

   // Update or add the player to the control
   if (EndGameGuiList.getRowNumById(%clientId) == -1)
      EndGameGuiList.addRow(%clientId, %text, %clientId);
   else
      EndGameGuiList.setRowById(%clientId, %text);

   // Sorts by score
   EndGameGuiList.sortNumerical(1,false);
   EndGameGuiList.clearSelection();
}


I am positive it is not my data because if I change this line:
%text = StripMLControlChars(%name) TAB %kills TAB %deaths TAB %score;
to
%text = StripMLControlChars(%name) TAB %kills TAB %score TAB %deaths ;
I get the same problem but the %score value is present, just where %deaths used to be, and the %deaths is not.

Any ideas?

#1
06/11/2008 (12:12 pm)
Tried my best at reproducing the problem, but without success. Could not get the control to drop columns using your setup. Also stepped through the relevant code, but found nothing.

Could you give a little more information on your setup that leads to the problem? Have you modified other relevant pieces (like e.g. the GuiTextArrayProfile)?
#2
06/11/2008 (12:24 pm)
Thanks I forgot to update this, I went line-by-line through my script. It was my fault. Thanks anyway.
#3
06/11/2008 (1:24 pm)
Okay, glad the problem's solved. *Please* keep bug reports updated, though, as anything here in this forum is actively monitored. This helps avoiding people wasting their time.