Game Development Community

Need help with lists in TGE

by Nicolai Dutka · in Torque Game Engine · 02/19/2008 (3:56 pm) · 4 replies

2 Problems:

I am doing the gui for a program in Torque 3d and need to know how to make a list that is scrollable and can be modified dynamically just like a simgroup (adding items, removing items).

1. I put in a GuiScrollCtrl and inside that I have a GuiDirectoryFileListCtrl. The list can be updated by adding files to the correct directory. This is perfect. The thing is, I don't know how to tell it to use a different directory!

2. I can click on items in the GuiDirectoryFileListCtrl and holding Ctrl, I can select/deselect multiple items. This is PERFECT! Now, say I wanted to delete those items from the directory... How would I do that?

#1
02/20/2008 (6:39 am)
I found this resource on TDN: http://tdn.garagegames.com/wiki/TGB/MiniTutorials/GUIListEdit
#2
02/20/2008 (6:56 am)
Figures, that tutorial is INCOMPLETE!!

I don't know what it's missing, but I assume the scroller window is suppose to have some kind of text list control in it (for adding the text items to the list).

Can someone please help?
#3
02/20/2008 (7:07 am)
Ok, using that tutorial and a ".dump" of my text list, I managed to get the following code to work, but I have one more problem:

function addToCart()
{
   // First we grab the test from the text edit control
   %text = "test";
   
   // Now we add that text to the list box control
   cartList.addRow(0,%text);
}

function removeFromCart()
{
   // get the selected item, this is an index in the list
   %selected = cartList.getRowID(cartList.getSelectedID());
   
   // delete the selected item
   cartList.removeRow(%selected);
}

That code works beautifully! I am just wondering how I would go about allowing multiple selections? So like, hold and click items in the list to select/deselect as many as you want, then run "removeFromCart" to remove all selected items at once.

Any ideas for that one??
#4
02/20/2008 (8:53 pm)
I won't swear to this but I don't think it has multiple selection functionality.