Game Development Community

How can I change the font color of text in the GuiTextCtrl?

by qiansheng · in Torque 3D Professional · 01/06/2013 (12:56 am) · 14 replies

Yes, I know that I can create a new profile to make it. But I think that it is not convenient. I will have to make many profiles, and using profile is not simple.

Can I change the font color of the text in the GuiTextCtrl not by creating a new profile for the GuiTextCtrl?

If anyone can solve this problem, I will thank you very much.

#1
01/06/2013 (6:28 am)
I think only Gui ML text control is able to do that...
#2
01/06/2013 (7:01 am)
I know it's not obvious, but if you think of profiles as a container for themes instead of individual color or font related changes you'll soon outgrow the belief that they are not convenient.

If you really want to define fonts and colors on a control specific basis that will have to be added in through the source... and surely it can be done but the maintenance headache would outweigh any possible benefit.
#3
01/07/2013 (1:52 am)
michael,
i was thinking to look on that.
but never got time to look into any gui related code.
do u have any idea on how much code changes it will need?
#4
01/07/2013 (9:36 pm)
Exactly, what I need to change contains font type and font size, too.
Is there anyone knowing how to solve this problem?
#5
01/10/2013 (1:02 pm)
To display permanent results use some basic profiles and GuiTextCtrl.
For continuously differentiated use GuiMLTextCtrl is very flexible and you can have a different font, size and color at once.
GuiMLTextCtrl also features automatic unfolding that helps measure the height and placement this in changing contexts.
#6
01/11/2013 (7:45 am)
It kind of makes me wonder why we have GuiTextCtrl if GuiMLTextCtrl is much more powerful with the exact same features.
#7
01/11/2013 (11:52 am)
@Robert: Same reason most GUI frameworks provide plain text, rich text, and HTML content editing and display controls. It all depends on what your needs are and wanting to be as resource efficient as possible. You wouldn't use nothing but HTML controls to just display plain text fields would you?
#8
01/11/2013 (4:15 pm)
Torque's GUI is really more powerful and in-depth than most people would need for use in a game....
#9
01/12/2013 (1:33 am)
And it also needs some significant work to make it cleaner and more consistent. I totally agree that you can do amazing things with it - just look at the screenshots from 3 Step Studio - but even without adding any new features there is much room for improvement.

We have tweaked things a little so that you can now wrap tool tips to a specified pixel width and have added a callback to GuiScrollCtrl (you might be surprised how handy that was) just to point out a couple of things. Something to add would be more comprehensive tool tip backgrounds - say a bitmap array setup like other text controls. Honestly, I've got a wish list a mile long on this one before even starting on new features....
#10
01/12/2013 (4:18 pm)
For the given opportunity there is a serious Problems with GuiMLTextCtrl.
Make a GuiWindowCtrl in a new GuiControl, put a GuiScrollCtrl and in GuiScrollCtrl place a GuiMLTextCtrl.
When we ask the appearance of this window GuiMLTextCtrl does not automatically update but requires pressing the mouse.
Workarounds for this problem?
#11
01/15/2013 (1:29 pm)
Hey - you can create profiles on the fly. And you can change their properties at any time.

You could make a function like so:
function createCustomProfile(%controlName, %fontColor, %fontSize)
{
   %newProfile = new GuiControlProfile(%controlName@"CustProfile" : GuiDefaultProfile)
   {
       fontColor = %fontColor;
       fontSize = %fontSize;
   }
   %controlName.setProfile(%newProfile);
}

And your control would have your new profile assigned. Boom! Of course, this could be vastly improved upon - just a simple example.

@Dimitris - try calling the forceReflow() method on your MLTextControl after updating its contents. That should update it.
#12
01/19/2013 (1:41 pm)
Thanks Richard
forceReflow() working rightly
I am on a mmo project, near to beta and i have another one microproblem.
if you can help me with this I will be close to full function for everything I need from the T3D.
I use very often the appearance and disappearance of a meshes to characters for clothing various apparels.
working properly.
All the mesh changes in real time for all players in the game is working very well.
But when a new character makes login and entrance to game view all meshes.
After player refresh any view of mesh working properly again.
Any idea for this?
#13
01/19/2013 (10:23 pm)
Search the engine for meshSetHidden or something similar - or search the forums for "mesh hiding". If you have the zombie pack the MegaZombie script uses this technique to generate random zombies.
#14
01/23/2013 (10:53 pm)
I've searched it for some time now, is a problem that concerns only the entry of new players into the game, in all other cases it works well. Not inform a player who makes login the hiding meshes of the others players. Any new change on mesh working good for all online players.
Not respect the code I think but the automatic update from server to client for the hiding meshes. This game is a mmo, players entering and leaving all the time.
Also the GuiObjectView not manage mesh hiding system?
Is there something to learn or need to modify the gui in engine?