Game Development Community

GUI Question Thread

by Matthew Langley · in Torque Game Builder · 08/28/2006 (3:57 pm) · 10 replies

With all the questions lately on the GUI system, as well as our lack of documentation on it, I decided to create a thread explicitly for GUI questions. If you want to know what a control is, what certain methods are, etc... please feel free to post the question here. Associates and helpful community members feel free to post answers, or partial answers. I'll try to keep up on this thread and answer, even if I have to dig into some info for it :) I am also going to see if we can get a GUI forum going to help remedy some of these question communication problems.

About the author

Was a GG Associate and then joined GG in 2005. Lead tool dev for T2D and T3D. In 2011 joined mobile company ngmoco/DeNA and spent about 4 years working game and server tech. 2014 joined startup Merigo Games developing server technology.


#1
08/28/2006 (10:10 pm)
Well since you asked.. Where can I find a list of tags for the GuiMLTextCtrl, possibly also listing what they do? I can't recall ever seeing a reference for that.
#2
08/29/2006 (12:00 am)
When will there be documentation on the GUI system? It's so bewildering that I really don't know where to begin. The tutorials are ok but only touch the very tip of the surface.

What does each profile do specifically?

How can we create new profiles?
#3
08/29/2006 (1:19 pm)
GuiMLTextCtrl / GuiMLTextEditCtrl Tags:
==============

- Insert a new line
- Change Font and Size
- Create an Anchor point
- Change font Color and Optionally Alpha
- Change Shadow Color and Optionally Alpha
- Change Link Color and Optionally Alpha
- Change Link Highlighted Color and Optionally Alpha
- Shadow Offest
- Inline Bitmap
- Save Formatting information
- Restore Saved Formatting information
- Justify Left
- Justify Right
- Justify Center
- URL to a website
- Set Left Margin as a Percentage of width
- Set Left Margin
- Set Right Margin as a Percentage of width
- Set Right Margin
- creats a divider
- Set tab stops

- Unknown
- Unknown

-----------------------------------------------------------------------------------------
Profile Properties
============
tab - True if this object is accessable from using the tab key
canKeyFocus - True if the object can be given keyboard focus (in other words, made a first responder
mouseOverSelected - True if this object should be "selected" while the mouse is over it

modal - True if this is a Modeless dialog meaning it will pass input through instead of taking it all
opaque - True if this object is not translucent
fillColor - Fill color, this is used to fill the bounds of the control if it is opaque
fillColorHL - This is used insetead of fillColor if the object is highlited
fillColorNA - This is used to instead of fillColor if the object is not active or disabled
border - For most controls, if mBorder is > 0 a border will be drawn, some controls use this to draw different types of borders however
borderThickness - Border thickness
borderColor - Border color, used to draw a border around the bounds if border is enabled
borderColorHL - Used instead of borderColorwhen the object is highlited
borderColorNA - Used instead of mBorderColor when the object is not active or disabled

bevelColorHL - Used for the high-light part of the bevel
bevelColorLL - Used for the low-light part of the bevel

fontType - Font face name for the control
fontSize - Font size for the control
fontCharset - Font character set
fontColors - Array of font colors used with escape characters for changing color mid-string
fontColor - Main font color
fontColorHL - Highlited font color
fontColorNA - Font color when object is not active/disabled
fontColorSEL - Font color when object/text is selected
fontColorLink - Font color for hyperlinks
fontColorLinkHL - Font color when a hyperlink is highlited
justify - Alignment of text in a text control
textOffset - Offset of text in a text control
autoSizeWidth - Auto-size the width-bounds of the control to fit it's contents
autoSizeHeight - Auto-size the height-bounds of the control to fit it's contents
returnTab - Used in GuiTextEditCtrl to specify if a tab-event should be simulated when return is pressed.
numbersOnly - For text controls, true if this should only accept numerical data
cursorColor - Color for the blinking cursor in text fields (for example)

bitmap - Bitmap file name for the bitmap of the control

soundButtonDown - Sound played when the object is "down" ie a button is pushed
soundButtonOver - Sound played when the mouse is over the object

-------------------------------------

Can you create a new profile? Yes you can, but you must load the TorqueScript file containing it before you load the GUI file that makes reference to it.
#4
08/29/2006 (2:55 pm)
Very good! thanks labrat, since we are in the topic. How can I change the coordinates of the GUI to those of the screen (t2dscene) and vice versa?
#5
08/29/2006 (4:50 pm)
Here's one: is there a way to change the font, size, and style of the text in a GuiMLTextCtrl?
#6
08/29/2006 (6:24 pm)
Vern, please see the post by LabRat (3 posts up).
#7
08/29/2006 (7:03 pm)
Thank you very much Labrat! Exactly what I was looking for. I found this elsewhere: - line break
#8
08/29/2006 (7:59 pm)
Ok, How do we customise the GuiWindowCtrl?

Right now the only options that I have found are:

Use:
Profile="EditorWindowProfile"; //which is kind of cool, transparent grey, rounded edge window.
Profile=""; //(dull solid grey boring squarish window)

I wanted to make a modified version of the "EditorWindowProfile" which I cant seem to find in my non-source Indie version of TGB, I assume it's wrapped up in the editor. (I looked in every .cs, and .gui file).

I did the .dump() to find the image location for the window parts. (window.png).
I tried copying the window.png to my own images folder, which I then modified (for colors only)

However I could never get the
bitmap = "~/data/images/window"; to work either in a profile of my own, or during the new GuiWindowCtrl() call in the .gui file. (I tested all variations on the path here too, just in case it was path issue)

Am I missing something simple? can we customize window controls?

Thanks in advance.

EDIT: for grammer... and removed duplicate statement.
#9
08/29/2006 (8:45 pm)
Solved my issue:

I HAD to put my window profile:

new GuiControlProfile (tgbWindowProfile)
{
opaque = false;
border = 2;
fillColor = "0 255 0 128"; // Background Color, used to define the typical window's background.
fillColorHL = "0 255 0 128";
fillColorNA = "0 255 0 128";
fontColor = "0 0 0";
fontColorHL = "0 0 0";
bitmap = "./images/window"; // This is where you locate the image.
textOffset = "6 6";
hasBitmapArray = true;
justify = "center";
};

At the TOP of the .gui file for it to work.

Any where else, like say my profiles.cs (exec'd before the gui was loaded) did not work.

Sweet.

EDIT: which in turn led me to the fact that I was editing the WRONG profiles.cs and thus the reason I had all the problems..

Summary: Just load the profile before the gui, and you are set.
#10
08/29/2006 (9:41 pm)
There are a couple basic tutorials on the GUI system here, including an introduction to profiles.

Edit: Before anyone read this, I wanted to specify that I'm not trying to discourage anyone from asking questions, just trying to privide some extra help if anyone needed it.