MultiLineEditbox and font colo(u)r

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

reacher
Just popping in
Just popping in
Posts: 8
Joined: Thu Apr 02, 2009 14:29

MultiLineEditbox and font colo(u)r

Postby reacher » Thu Apr 09, 2009 15:00

I saw a long discussion in the suggestions forum about implementing multiple colors in a single text string. Is there already functionality that allows for differing colors on a per-line basis for the MultiLineEditbox? With the existing properties, I can change the color for all the text at once, but not for each line. Would I need to delve into the CEGUI::MultiLineEditbox code myself to add this functionality?

Thanks!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Thu Apr 09, 2009 16:04

pretty sure you can set various colors per item; for example, I use this code to set the text-color to black, the blackground to white, and selection-colour to blue:

Code: Select all

CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem("blah");
item->setTextColours(CEGUI::colour(0,0,0,1));
item->setSelectionBrushImage(CEGUI_SKIN, "Background");
item->setSelectionColours(CEGUI::colour(.12f,.12f,1,1));

CEGUI::uint row = mcl->insertRow(n);
mcl->setItem(item, CEGUI::MCLGridRef(r, 0));

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Fri Apr 10, 2009 09:07

That's all true, but if you meant multi coloured text like this then currently that's not easily done, though a basic implementation should be added for the 0.7.0 release - and better than that, it will be customisable, so if you need something a bit special you will be able to provide an object to do that.

HTH

CE.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Fri Apr 10, 2009 16:13

Yeah, sorry. I was thinking MultiColumnList not MultilineEditbox; as an excuse, I have a headcold! For v0.6 you would have to add this functionality yourself...

reacher
Just popping in
Just popping in
Posts: 8
Joined: Thu Apr 02, 2009 14:29

Postby reacher » Mon Apr 13, 2009 04:16

Thanks guys! Jamarr your insight made me realize I should be using a Listbox instead of the MultiLineEditbox. The main issue is the MultiLineEditbox uses a single String to hold all the text. IOW very difficult to format it on a per line basis. The Listbox was just what I needed :D


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests