Game Development Community

GuiTreeViewCtrl

by Robert Stewart · in Torque Game Engine · 09/24/2005 (1:40 pm) · 4 replies

I'm having trouble using the new 1.4 version of GuiTreeViewCtrl.

This is what I'm doing,
editortree.insertitem(0, "New", "New", "Item"); // That should use the default Item icon

All I get is the new item, with no icon.

If I do this,
editortree.insertitem(0, "New", "New", "New", 10);

Then it creates the sun icons, or icon associated with the number.

In editor.cs you appear to do it the way need it done.
%this.insertItem(%grp, %obj.getName(), %obj.getClassName() @ "::create(" @ %obj.getName() @ ");","Item");

By looking at getIcon
S32 GuiTreeViewCtrl::getIcon(const char * iconString)
{
   S32 icon = Default;
  ....
   else if (!dStrcmp(iconString, "Item"))
      icon = Shape;
  ....
}

It looks like I can use a string and have no need for a number.

Anyway what I'm trying to do is create items on the fly, and associate a new image with it.
Something like this editortree.insertitem(0, "MyNewItem", %Id, %icon); , I would want %icon to be able to point to any icon in a my folder. Any ideas, comments or fixes.

#1
09/24/2005 (4:48 pm)
Ben Garney I know you have the awnser to this.. Dont work on the weakends?
#2
09/24/2005 (7:12 pm)
He's visiting his parents this weekend. No need to get snippy.
#3
09/24/2005 (7:39 pm)
Everything I say online sounds snippy, wasent ment to.
(Mainly just a joke, I dont expect(demand?) anything from anyone on this site)

Hope you have a good time Ben.
#4
09/25/2005 (6:08 pm)
Just adding some if clauses to that function would do it. We need a more flexible interface in that area of the treeview control but it probably won't happen for 1.4. So for now, hacks and workarounds will have to do.

And yes, I had a good vacation. Yummy homecooked food. :)