Static text alignment and properties

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

pianoman
Just popping in
Just popping in
Posts: 12
Joined: Fri Mar 20, 2009 23:22
Location: Nebraska, USA

Static text alignment and properties

Postby pianoman » Thu Apr 22, 2010 15:02

Hi, I'm trying to left-align the text in a static text widget. On a static text widget, I tried:

Code: Select all

lblAction->setProperty("HorzLabelFormatting", "HorzLeftAligned");

But got an exception about HorzLabelFormatting not being an available property. I also tried "HorzFormatting" with the same result. Any ideas? Also, is there a reason that these common widget-specific properties are not available as getters/setters on the widget classes themselves? Having to reference string property names in code is very difficult compared to using a method, which is available through an IDE's completion assistance.

I fount the latter in a forum question where someone had a similar problem, and the former i found on the wiki page that lists all the properties for all the widgets (maybe it's not up to date or something).

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

Re: Static text alignment and properties

Postby CrazyEddie » Fri Apr 23, 2010 08:49

The correct property name is "HorzFormatting" and the available settings are as follows:

Code: Select all

"LeftAligned"
"RightAligned"
"HorzCentred"
"HorzJustified"
"WordWrapLeftAligned"
"WordWrapRightAligned"
"WordWrapCentred"
"WordWrapJustified"


The reason there is no member function on the StaticText for these types of setting is because there is no StaticText class, it's implemented via a DefaultWindow and a custom WindowRenderer. In this particular instance, you could actually get access to the WindowRenderer (in this case CEGUI::FalagardStaticText) and use member functions on that class to get/set the formatting (see: http://www.cegui.org.uk/docs/current/cl ... cText.html).

Though note that in some other instances there may not be any code at all to support such options since they are sometimes implemented via properties defined via XML alone.

HTH

CE

pianoman
Just popping in
Just popping in
Posts: 12
Joined: Fri Mar 20, 2009 23:22
Location: Nebraska, USA

Re: Static text alignment and properties

Postby pianoman » Fri Apr 23, 2010 13:55

Ah, no "Horz" before "LeftAligned". Thank you. :D Is there a particular place I should be looking to see what values are available for a property? (Instead of wasting your time...) That wikipage I mentioned is a bit out of date apparently; I suppose I could use that same tool to output my own 'documentation'.

Hooray for getters/setters on the Falagard classes. Thanks for pointing that out. I kind of forgot about the Falagard classes :oops: .

Cheers :pint:


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 15 guests