GuiTextListCtrl (changing background color)
by Stanley D Chatman · in Torque Game Builder · 03/06/2007 (2:12 pm) · 6 replies
How do you change the background color for a guiTextListCtrl object. This is my custome profile I have built but I cannot figure out how to make the background of the list box Black. It is currently white/beige.
if(!isObject(myOptionsProfile)) new GuiControlProfile (myOptionsProfile)
{
opaque = true;
//fillColor = "0 0 0";
fillColorHL = "0 156 0";
border = -2;
borderColor = "40 40 40 100";
//fontColor = "111 111 111";
fontColor = "255 130 0";
fontColorHL = "23 23 23";
fontColorNA = "255 255 255";
textOffset = "4 2";
autoSizeWidth = false;
autoSizeHeight = true;
tab = true;
canKeyFocus = true;
fontType="Wee Bairn";
fontSize = 20;
};
#2
03/09/2007 (1:15 am)
You might want to study the GuiControlProfile documentation. I believe the "justify" member will do what you want.
#3
03/09/2007 (2:23 am)
I modified my profile to make use of the justify property but still no go. Here are my current profiles:if(!isObject(myScrollProfile)) new GuiControlProfile (myScrollProfile)
{
opaque = true;
fillColor = "0 0 0";
border = 1;
borderThickness = 2;
borderColor = "255 255 255 100";
bitmap = "~/data/images/scrollBar";
hasBitmapArray = true;
fixedExtent = true;
justify = "center";
autoSizeWidth = false;
autoSizeHeight = true;
};
if(!isObject(myOptionsProfile)) new GuiControlProfile (myOptionsProfile)
{
opaque = true;
fillColor = "255 0 0";
fillColorHL = "0 156 0";
border = -2;
borderColor = "255 255 255 100";
fontColor = "255 255 255";
fontColorHL = "255 255 0";
fontColorNA = "255 0 0";
textOffset = "4 2";
autoSizeWidth = false;
autoSizeHeight = true;
tab = true;
canKeyFocus = true;
fixedExtent = true;
justify = "center";
fontType="Wee Bairn";
fontSize = 32;
};
#4
So, it appears that you are stuck with flush left text in the guiTextListCtrl, sorry.
FYI, three GuiControl classes use the C++ function dglDrawTextN() to render text: guiTextListCtrl, guiMLTextCtrl, and guiMessageVectorCtrl. None consult the profile's justify member field.
The base control class, GuiControl, does refer to the profile's justify member field, and it uses dglDrawText() to render the text. Several other GuiControl classes do likewise, including guiTextEditCtrl, guiPopupCtrl, guiPopupCtrlEx, GuiConsoleTextCtrl, and guiTabBookCtrl. Probably yet more GuiControl classes simply leave the rendering of text to the base GuiControl class and thereby inherit the default behavior.
Bad news, but I hope it clarifies things for you.
03/09/2007 (5:28 am)
I looked at the code for ./engine/source/gui/controls/guiTextListCtrl.cc. From what I can see there, and from what you say, I have to conclude that profile.justify does not come into the picture. So, it appears that you are stuck with flush left text in the guiTextListCtrl, sorry.
FYI, three GuiControl classes use the C++ function dglDrawTextN() to render text: guiTextListCtrl, guiMLTextCtrl, and guiMessageVectorCtrl. None consult the profile's justify member field.
The base control class, GuiControl, does refer to the profile's justify member field, and it uses dglDrawText() to render the text. Several other GuiControl classes do likewise, including guiTextEditCtrl, guiPopupCtrl, guiPopupCtrlEx, GuiConsoleTextCtrl, and guiTabBookCtrl. Probably yet more GuiControl classes simply leave the rendering of text to the base GuiControl class and thereby inherit the default behavior.
Bad news, but I hope it clarifies things for you.
#5
03/19/2010 (1:15 pm)
How would I modify the 'mouse over' FILL color for the list? I've got ALL the colors the way I want except that one... It's like it just doesn't want to do a fill color on mouse over, only when I 'select' an item from the list...
#6
I haven't tested this, so let me know if you run into any problems!
03/19/2010 (3:46 pm)
It looks like you need to set "mouseOverSelected = true;" in the gui profile. Then the borderColorHL and fillColorHL will be used to do a filled rectangle with fontColorHL used to render the text (the same as when the item is selected).I haven't tested this, so let me know if you run into any problems!
Torque Owner Stanley D Chatman
One thing I am still working on is how do you center text in the listbox. It is always "Left Aligned" and I would like to center it.
if(!isObject(myScrollProfile)) new GuiControlProfile (myScrollProfile) { opaque = true; fillColor = "0 0 0"; border = 1; borderThickness = 2; borderColor = "255 255 255 100"; //bitmap = "./images/scrollBar"; //hasBitmapArray = true; };