Center a text control
by Jason McIntosh · in Torque Game Builder · 04/13/2005 (7:42 am) · 3 replies
Anybody know how to make a GuiTextCtrl update so that it's centered? I've got the horizontal sizing set to "centered" but it doesn't change when I alter the control's text. I tried using repaint() but that didn't work.
Tried searching forums and resources but found nothing except a 3d text control resource.
Tried searching forums and resources but found nothing except a 3d text control resource.
About the author
Torque Owner Fenrir Wolf
So, in short:
// in your local profile definitions // (I call my "profileoverrides.cs" as they // override/superceed the profiles defined by common.) new GuiControlProfile (CenteredTextProfile) { fontType = "Arial"; fontSize = 12; fontColor = "255 255 255"; fixedExtent = true; justify = "center"; }; // in your gui: new GuiTextCtrl() { position = "20 20"; extent = "400 50"; profile = "CenteredTextProfile"; horizSizing = "bottom"; vertSizing = "left"; text = "Centered Text" ; }Also, I believe you can get the same effect by setting the text to use TGE's built-in HTML-lite tags: "