Game Development Community

Aliging Text

by Wil Klentzeris · in Torque Game Builder · 10/02/2006 (6:32 pm) · 1 replies

Does any one know how to align the content of a guiTextCtrl?

I would like to center and right align.

Suggestions please....

#1
10/03/2006 (5:59 am)
The short answer if you set the justify property in the profile used by the control.

Look at the source for your GUI file, find the guiTextCtrl you want to justify and look at what its "profile" is set to, for example GuiTextProfile. Then locate this profile, I'm not sure what cs file it is in with TGB, but with TGE it will be in a file called defaultGameProfiles.cs or customProfiles.cs

Then just add the "justify" property to the profile.

if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
{
   // ... various properties....
   justify = "center";

or "left" or "right"

However, this will "justify" EVERY control that uses this profile. If you only want to the justify one, or a selection of guiTextCtrls then copy the profile and change its name. Then after updating the justify property go back to your original gui file and change the "profile" for your control to the new profile eg "GuiTextProfileLeft".

if(!isObject(GuiTextProfileLeft)) new GuiControlProfile (GuiTextProfile)
{
   // ... various properties....
   justify = "left";