Game Development Community

[Resolved] Child GUI controls render on top of their parents??

by Ted Southard · in Torque Game Engine Advanced · 05/22/2009 (8:36 am) · 2 replies

So I'm creating the new GUI for Epic Frontiers, and I noticed that when I make the minimap a child to a bitmap frame, it's actually rendered on top of the frame. Here are the GUI controls as seen in my script file:

new GuiBitmapCtrl(CtrTopFrame) {
      isContainer = "1";
      Profile = "GuiModelessDialogProfile";
      HorizSizing = "center";
      VertSizing = "top";
      Position = "382 20";
      Extent = "261 129";
      MinExtent = "261 129";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      bitmap = "scriptsAndAssets/client/ui/img/ctr-menu-hub-frame.png";
      wrap = "0";
      
      new GuiCommanderHud(Map) {
         Profile = "GuiModelessDialogProfile";
         HorizSizing = "center";
         VertSizing = "top";
         Position = "69 4";
         Extent = "122 122";
         MinExtent = "122 122";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         cameraZRot = "0";
         forceFOV = "0";
         panSpeed = "10";
         zoomSpeed = "1";   
         //isFirstResponder = "1";
         //useMouseEvents = "1";
      };
   };

I figured that the hierarchy here would have the frame rendering on top of its children, but that's not happening. Now that I noticed that, I'm also seeing it with any control where I have a child inside of it like this. Is there something I'm missing to both have the control rendering in the proper order and have it remain a child? Thanks in advance for any information anyone has.

#1
05/22/2009 (11:17 am)
yep. the parent control renders itself and then renders its children.
which makes sense. consider a container such as an opaque GuiWindowCtrl - it can't render after the children or the children wouldn't show up.

if you have visual aspects of the parent which you want rendered on top of the child, i would suggest making a container and making what was previously the parent into a "younger sibling" of what was previously its child.

eg, change this:
GuiBitmapCtrl
   GuiCommanderHud
to this:
GuiControl
   GuiCommanderHud
   GuiBitmapCtrl
#2
05/22/2009 (11:25 am)
Yep, that does make sense.

I think for simplicity's sake, I'll keep them separate and just put the map before it.