Jump to content

[SOLVED] GUI - GetWidth / GetHeight


photo

Recommended Posts

Hello guys,

 

i attached an example with my problem, in a shutnell:

I'm creating an dynamlicy gui, without using an ".ui" file, so all is done in code behind, now i want to add a sprite, and at this point i hit the actual problem.

My sprite should overlay the WidgetTabBox, in this we create the dynamic widgetelements, so after i run through my initialize method, the WidgetTabBox.getHeight and .getWidth are "0".

So i cant set my width and height to my spritelement.

 

The only thing which i can do, to set in the "update" function the setWidth and setHeight action for my sprite (but thats not nice to handle...).

So i / we would need an event-trigger which creates the gui, or can set a function after the trigger was runned, or an function where i can overgive my Container and this function would count together which "height" and which "size" the element have.

 

I hope u understand.

The demo should explain the problem easier.

 

Greetings

Lars

ui_layout.zip

Link to comment

Hey Lars,

 

You should call Widget::arrange() method if you want to get any sizes before first widget update.

 

Just add this lines in init function:

 

mainTabBox.arrange();
sprite.setWidth(mainTabBox.getWidth());
sprite.setHeight(mainTabBox.getHeight());

Link to comment
×
×
  • Create New...