Page 1 of 1
MultiLineEditbox and font colo(u)r
Posted: Thu Apr 09, 2009 15:00
by reacher
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!
Posted: Thu Apr 09, 2009 16:04
by Jamarr
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));
Posted: Fri Apr 10, 2009 09:07
by CrazyEddie
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.
Posted: Fri Apr 10, 2009 16:13
by Jamarr
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...
Posted: Mon Apr 13, 2009 04:16
by reacher
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
