Game Development Community

UI Section of General Torque Documentation

by Michael Hogsett · in Torque Game Engine · 03/04/2008 (2:54 pm) · 0 replies

Hello all. I, like many, are new to TGE. I've been going through the general torque documentation at http://www.garagegames.com/docs/tge/general/index.php and have come across something that I don't understand.

I'd like to understand what I did wrong before I move on to the next section.

In Chapter Three Section Four we create the "HelloWorld" dialog and within it create a GuiTextCtrl. For positioning we're told to set both the horizSizing and vertSizing to center to align the GuiTextCtrl in the middle of it's parent dialog window.

This does not work, unless I resize the dialog box after it is open. Likewise if I set the vertSizing and horizSizing for its parent dialog (GuiWindowCtrl) also to center it too does not work, unless I resize the Torque window.

Here's the GuiWindowCtrl after clicking "My First Button" : http://www.csl.sri.com/users/hogsett/GuiWindowCtrl_not_centered.png

And here it is centered after I maximized the Torque window and returned it to its normal size :
http://www.csl.sri.com/users/hogsett/GuiWindowCtrl_after_main_window_resize.png

Also see in both above that the GuiTextCtrl is not centered within its parent GuiWindowCtrl.

If I resize the GuiWindowCtrl it centers as I resize it.
http://www.csl.sri.com/users/hogsett/GuiTextCtrl_centered.png

I'd appreciate some explanation of why it isn't behaving as I'd expect.

I'm using TGE 1.5.2 on MacOSX Leopard 10.5.2 with XCode 3.

Thanks!

- Michael Hogsett

Here's the contents of the HelloWorld.gui file :

//--- OBJECT WRITE BEGIN ---
new GuiControl(HelloWorld) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "center";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";

new GuiWindowCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiWindowProfile";
HorizSizing = "center";
VertSizing = "center";
position = "131 84";
Extent = "285 265";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Hello World";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "Canvas.popDialog(HelloWorld);";

new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiTextProfile";
HorizSizing = "center";
VertSizing = "center";
position = "22 59";
Extent = "55 17";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Hello World";
maxLength = "1024";
};
};
};
//--- OBJECT WRITE END ---

About the author

Recent Threads