Jump to content

Extanding GuiTreeViewCtrl.


avovana
 Share

Recommended Posts

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?

Link to comment
Share on other sites

Adding method. Solved.

I succesfully added new method to the class I'm playing with.


I added a new method to the class:

int GuiButtonNewCtrl::getNewVar()
{
 return newVar;
}

 

And registered it with DefineEngineMethod:

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...