Page 1 of 1

Quick Text Question

Posted: Thu Jul 14, 2005 13:27
by wraithdrit
I'm using windowslook for my scheme. I have several static text windows. Is there a property that I can set up that will make the text word wrap automatically without me having to force line breaks with "\n"?

Also without having the full blown CEGUI source downloaded, is there somewhere I can get all the properties of each widget type within WindowsLook? And all their possible settings?

Last text related question. I want the window length to be based on how much space is required to show the text, can this be done as well?

Thanks,
Wraith

Re: Quick Text Question

Posted: Thu Jul 14, 2005 18:25
by CrazyEddie
You can set the horizontal text formatting to perform word wrapping, like this:

Code: Select all

myStaticText->setHorizontalFormatting(StaticText::WordWrapLeftAligned);


The other available formatting options can be seen here

There area also properties to set these options (see below for the answer to your related question).

You can see the properties for each widget by looking up the corresponding properties namespace here

You can manually set the window size to the length of text by using Font::getTextExtents and then setting the window width. There is no simple means provided for doing this automatically.

Re: Quick Text Question

Posted: Thu Jul 30, 2009 17:08
by Mozork
Hi,

I have a question related to this, so I'll post it here:

Code: Select all

CEGUI::Window* descriptionWindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", "Name");
descriptionWindow->setText("Text");
static_cast<CEGUI::StaticText*>(descriptionWindow)->setHorizontalFormatting(CEGUI::StaticText::WordWrapLeftAligned);


I create a StaticText Widget and set the text, so far, this works. Then I want to set the HorizontalFormatting, but apparently I don't have the proper files included because I get the error, that StaticText is not a member of CEGUI, so my question:
Is the class name "StaticText" correct for this purpose? Which files do I need to include, to have the class StaticText included?

Thanks in advance for your help.

Re: Quick Text Question

Posted: Fri Jul 31, 2009 08:55
by CrazyEddie
There is no StaticText class - it's all done via a custom WindowRenderer assigned to a DefaultWindow. In order to affect the StaticText specific properties, you use the property set interface, for example:

Code: Select all

CEGUI::Window* descriptionWindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", "Name");
descriptionWindow->setText("Text");

descriptionWindow->setProperty( "HorzFormatting", "WordWrapLeftAligned" );


CE.