Quick Text Question

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
wraithdrit
Just popping in
Just popping in
Posts: 3
Joined: Thu Jul 14, 2005 12:50

Quick Text Question

Postby wraithdrit » Thu Jul 14, 2005 13:27

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

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

Re: Quick Text Question

Postby CrazyEddie » Thu Jul 14, 2005 18:25

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.

Mozork
Just popping in
Just popping in
Posts: 9
Joined: Thu May 14, 2009 15:39

Re: Quick Text Question

Postby Mozork » Thu Jul 30, 2009 17:08

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.

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

Re: Quick Text Question

Postby CrazyEddie » Fri Jul 31, 2009 08:55

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.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 0 guests