Game Development Community

looking for gui mutiline text list

by elvince · in Torque 3D Professional · 01/03/2011 (10:35 am) · 2 replies

Hi,

I'm looking at multiline text list. I found single line but nothing with multiline. I bet there is something in core source or in resource but as the search function is down, if someone can pointing me in the right direction.

I'm looking something like guilistboxctrl with text on more than one line.

thanks,

#1
01/03/2011 (2:21 pm)
Three things:

1) You can go to Google and type "site:TorquePowered.com <keywords>" and search this site exclusively. I've been using it for about 2 years now, since the search engine on the site wasn't as good. That should get you up and running.

2) I didn't find anything doing a search for it just now.

3) I actually use GuiMLTextCtrl sort of like a list. Because the control can be used as hyperlinks, I use the control to trigger functions within script. Granted, it's not the same as a GuiMLTextListCtrl would be, but in the end I display lists of data and each line is clickable and executes functionality in the engine.

In this example, I set up a GuiMLTextCtrl within a scrollbar:
new GuiScrollCtrl(OutputScroll) {
      canSaveDynamicFields = "0";
      Enabled = "1";
      isContainer = "1";
      Profile = "GuiScrollProfile";
      HorizSizing = "right";
      VertSizing = "top";
      Position = "0 496";
      Extent = "395 230";
      MinExtent = "395 230";
      canSave = "1";
      Visible = "1";
      hovertime = $toolTipHover;
      willFirstRespond = "1";
      hScrollBar = "off";
      vScrollBar = "dynamic";
      constantThumbHeight = "0";
      childMargin = "2 2";
      willFirstRespond = "1";

      new GuiMLTextCtrl(testML){
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiMLTextProfile";
         HorizSizing = "right";
         VertSizing = "top";
         Position = "4 4";
         Extent = "380 235";
         MinExtent = "380 235";
         canSave = "1";
         Visible = "0";
         text = "";
      };
   };

Then I create a function to display a list within it:
$row = 0; //Just to keep track throughout the game session
function clientCmdPostMsg(%msg)
{
   //Use the <br> to separate the lines, and then use <a> to create
   //hyperlinks out of each item listed. The callback ::onUrl will
   //fire when the items are clicked on, and you can pull data you need
   //by embedding them in the <a> tag (not just the $row variable)
   testML.setText(testML.getText() @ "<br>" @ "<a:" @ $row @ ">" @ %msg @ "</a>");
   $row++;
   OutputScroll.scrollToBottom(); //Keeping it scrolled to the bottom
}

And finally, the functionality to fire a function when it is clicked on:
//Here, the first variable after %this is the URL- which in this case
//is the $row variable we insert in the <a> tag above, but it can be
//much more than that.
function testML::onURL(%this, %text)
{
   commandToServer('doStuff', %text);  
}

Of course, depending on what you need (especially if the functionality is very different for each choice), you'll need to get a bit creative with this to make it work, but it can be done.

Hope that helps.
#2
01/05/2011 (7:58 am)
thanks for the feedback.

I also use the GuiMLTextCtrl with a stack panel to simulate this and change the GuiMLTextCtrl to be able to add onClick/OnDblClick and use command/altcommand.

I thought about using the <A> but I thought I may have issue with color or a link under the text to click etc...

Do you know if GuiML support onmouseover color changes?