Jump to content

[SOLVED] Problem with nested box containers


photo

Recommended Posts

Hi all,

given the following ui file:

<?xml version="1.0" encoding="utf-8"?>
<ui version="1.0">
 <vbox name="PlayModeUI::panel" export="1">
<sprite name="PlayModeUI::base_gauge" export="1" pos_x="72" pos_y="0" color="#ffffff" texture="navantia3d/gui/play_gauge_base.png" align="overlap,background,fixed"/>
<icon pos_x="0" pos_y="55" texture="navantia3d/gui/play_shutdown_console.png" align="overlap"/>
<icon pos_x="216" pos_y="13" texture="navantia3d/gui/play_field_1.png" align="overlap,background,fixed"/>
<icon pos_x="216" pos_y="56" texture="navantia3d/gui/play_field_2.png" align="overlap,background,fixed"/>
<icon pos_x="216" pos_y="97" texture="navantia3d/gui/play_field_3.png" align="overlap,background,fixed"/>
<icon pos_x="216" pos_y="138" texture="navantia3d/gui/play_field_4.png" align="overlap,background,fixed"/>
<hbox name="PlayModeUI::heading_panel" export="1" pos_x="255" pos_y="22" background="1"> <!-- if align="overlap" content isn't shown-->
 	<sprite name="PlayModeUI::s80_top_mini" export="1" texture="navantia3d/gui/play_s80_top_mini.png" align="left"/>
 	<label name="PlayModeUI::heading_value" export="1" align="center">
   	<text face="ae3d/fonts/tungab.ttf" size="14">-000</text>
 	</label>
 	<label name="PlayModeUI::heading_units" export="1" align="right">
   	<text face="ae3d/fonts/tungab.ttf" size="12">º</text>
 	</label>
</hbox>
 </vbox>
</ui>

and the the code to load it:

/*
 */
void init(){
 // Get the default GUI used by the engine.
 Gui gui = engine.getGui();
 // Load all widgets from user interface file.
 ui = engine.gui.addUserInterface(gui,"navantia3d/gui/play.ui");
 // Add the menu window to be rendered in the default GUI. Only root widgets
 // should be added (their children will automatically become visible).
 gui.addChild(panel,GUI_ALIGN_TOP | GUI_ALIGN_LEFT | GUI_ALIGN_OVERLAP);
 panel.arrange();
}

If align="overlap" attribute is set to PlayModeUI::heading_panel:the result is:

post-59-0-34767200-1334218506_thumb.jpg

If I remove the attribute, thae panl shows its content (but in the wrong place obviously)

post-59-0-01223300-1334217640_thumb.jpg

 

Using UnigineScript I get the same result.

 

Best regards,

Iván.

Link to comment
  • 2 weeks later...
  • 2 weeks later...

Hi,

 

Sorry for late reply.

 

The problem is your root VBox tried to auto-layout its child widgets. You can detach your heading panel from that VBox and move it higher to hierarchy (in your case it'll be another root widget).

Link to comment
×
×
  • Create New...