Game Development Community

Can GUI objects be inherited?

by CdnGater · in Torque Game Engine · 04/01/2005 (3:53 pm) · 2 replies

I am trying to create a template of a control via script, but I am not having much success.

new GuiControl(TestTemplate) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   visible = "1";

   new GuiButtonCtrl(TestTemplateBtn) {
      profile = "GuiButtonProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "23 17";
      extent = "140 30";
      minExtent = "8 2";
      visible = "1";
      text = "Button";
      groupNum = "-1";
      buttonType = "PushButton";
  };
};

OK, thats a sample template, dunno if it right

now what I want to do is create new control based on that.

I have tried the following, and does not work
new TestTemplate( test1 )
{
   // Gives me an error about not being a CON Object
};

new GuiControl( test2 : TestTemplate )
{
   // Does absolutly nothing
};

new GuiControl( test3 )
{
   class = "TestTemplate";
// just laughs at me as class and superClass are only part of scriptObject
};

Can this even be done? If so, how, because I am at a loss.

Thanks

#1
04/02/2005 (1:43 pm)
You'd have to write a function to copy a template object hierarchy. The language doesn't support that ability intrinsically. You'll also want to rename them when you copy to avoid some nasty issues.
#2
04/02/2005 (4:15 pm)
Ah, ok..

That explains why it's not working.

Thanks Ben