Extanding GuiTreeViewCtrl.

There are no stupid questions, just stupid answers.
2 posts Page 1 of 1
Posts: 13
Joined: Sun Feb 25, 2018 2:32 am
by avovana » Tue Feb 27, 2018 8:03 am
Hello everyone!

I have very interesting task. I'm new in the gamedev that is why asking for your help.
I need to make some kind of extention of the GuiTreeViewCtrl class.

The task is:
  • Map chosen Xml file into a Tree.
1. Part.
I worked a bit with the SimXMLDocument() class. I tried an example from the documentation - mapped a small Xml to the GuiTextListCtrl.
I used TorqueScript for that. It works.

Now I need to try GuiTreeViewCtrl instead GuiTextListCtrl.
Ok. I will do it to understand better how GuiTreeViewCtrl works.

2. Part.
But what I can not image right now is about additional task:
  • There should be new control class that has tree to show and a field where the information from the selected item is shown.
3. Part
I'm thinking about few steps:
  1. Inherit from the GuiTreeViewCtrl;
  2. Add a string(or const char*) variable for a path to the xml file - "xmlPath";
  3. Add a setter - setXmlPath(const char*);
These are very first steps.
Here I have questions:
  • After making this 3 steps whould I have access from the Gui Editor to call the setXmlPath() method(so via TorqueScript)?
  • How to add new gui field to this class? Erm.. maybe GuiTextField to this class?
Posts: 13
Joined: Sun Feb 25, 2018 2:32 am
by avovana » Tue Feb 27, 2018 9:52 am
Adding method. Solved.
I succesfully added new method to the class I'm playing with.

I added a new method to the class:

Code: Select all

int GuiButtonNewCtrl::getNewVar() { return newVar; }
And registered it with DefineEngineMethod:

Code: Select all

DefineEngineMethod(GuiButtonNewCtrl, getNewVar, int, (), , "Get the text display on the button's label (if any).\n\n" "@return The button's label.") { return object->getNewVar(); }
Ok. It works with int. But conceptually problem about transmission data to the class using TorqueScript is solved.
2 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests