Getting GuiTSCtrl from subcontrols
by Orion Elenzil · in Torque Game Engine · 12/19/2005 (11:08 am) · 2 replies
I'm probably overlooking something obvious here,
maybe someone can point me in the right direction.
I have a GuiControl which wants access to its GuiTSCtrl parent (in onRender say)
but don't know how to get a handle to that parent.
ShapeNameHud does it seemingly by assuming that the ShapeNameHud control is the immediate child of a GuiTSCtrl, but i'd like to allow the control to be nested arbitrarily deep.
Something like this would be perfect:
GuiControl::GetKindOfParent(classID kind)
maybe someone can point me in the right direction.
I have a GuiControl which wants access to its GuiTSCtrl parent (in onRender say)
but don't know how to get a handle to that parent.
ShapeNameHud does it seemingly by assuming that the ShapeNameHud control is the immediate child of a GuiTSCtrl, but i'd like to allow the control to be nested arbitrarily deep.
Something like this would be perfect:
GuiControl::GetKindOfParent(classID kind)
About the author
Associate Kyle Carter
GuiTSCtrl *goal = NULL; GuiControl *gc = this; while(gc = gc->getParent()) if(goal = dynamic_cast<GuiTSCtrl*>(gc)) break; if(goal) then we're in a valid situation!