Game Development Community

T3D 1.2 - Gui - Center issue - LOGGED (THREED-3145)

by elvince · in Torque 3D Professional · 12/21/2011 (8:36 am) · 3 replies

Issue:
In my gui I set a GuiBitmapCtrl set with horizSizing = "center" & vertSizing = "center";
When my gui is loaded, my bitmap is set its default place and not in the center of the screen.

If I open the gui manager (F10) then my bitmap is accurately positioned.
If I resize my game screen then my bitmap is accurately positioned.

Solution:
I looked briefly in the code and the only place where the center is managed is in GuiControl::parentResized.
I suspect, it's not called when the control is at the root level when the gui is loaded.

Thanks,

#1
12/21/2011 (11:50 am)
The easiest way to fix it is simply resize the parent control if it's a window, or come out of the GUI editor (press F10) and resize your game window, and then go back into the GUI editor (press F10 again) and save your GUI for it to keep its position that you've wanted. horizSizing and vertSizing fields have always worked with the current position of the control as the reference to the actions you specified within those fields. Hence why you must resize the parent control that your control is sitting within in order for it to automatically Center on the parent when using center action.
#2
12/22/2011 (2:45 am)
Nathan,

I understand your workaround, but for me it's a bug that the horizSizing and vertSizing fields are not taken into account immediately when the UI is loaded.
Maybe, when the position is set (during the onAdd or during an update), it should look at those fields to override the value.

It's similar to "Center" in Word, are you expecting to change the size of your document to see the text centered?
I don't think this is a huge fix to implement, but this is part of the polishing of the editors & user friendly layer of Torque3D.

Thanks,
#3
01/11/2012 (10:23 am)
Thank you for the bug report Elvince. I've gone ahead and logged this bug under ticket number THREED-3145 for review.