Page 1 of 1

HorzAlignmentProperty

Posted: Wed Apr 21, 2010 15:37
by cippyboy
This is killing me for some time and I'm either unaware of the correct spelling or such a feature doesn't exist. I'm using CEGUI 0.6.2 and I'm trying to make a definition for a widget that by default is center aligned and has horizontal alignment property, making it either left or right aligned on occasion.
I define a property like this
<PropertyDefinition name="HorzFormatting" initialValue="CenterAligned" redrawOnWrite="true" />

and setting up like this in a text component doesn't work :
<HorzFormatProperty name="HorzFormatting" />

But I then looked at other definitions and saw that there's multiple cases of

<HorzAlignment type="RightAligned" />

so I'm wondering, why isn't there a HorzAlignmentProperty because I'm assuming this is what I need to use to set the alignment ?

Re: HorzAlignmentProperty

Posted: Thu Apr 22, 2010 08:34
by CrazyEddie

Re: HorzAlignmentProperty

Posted: Thu Apr 22, 2010 13:17
by cippyboy
Yeah like that one, although if you were suggesting setting it from code, I was sorta thinking to use it from the layout file. Or are you saying to just rename the value of the property from CenterAligned to Centre ? (saw the difference in spelling in the link you gave me)

Re: HorzAlignmentProperty

Posted: Fri Apr 23, 2010 08:41
by CrazyEddie
You can use it in layouts (or code) like with all other properties, so within a layout:

Code: Select all

...
<Property Name="HorizontalAlignment" Value="Centre" />
...


CE

Re: HorzAlignmentProperty

Posted: Mon Apr 26, 2010 14:22
by cippyboy
Hm, ok this is kinda weird. I'm trying to set the alignment of a piece of text from a tab button to avoid duplicate definitions for just a single property changed. When I used what you gave me it aligned the tab in the center of it's parent window. How do I set the property for the text inside it ?

Re: HorzAlignmentProperty

Posted: Wed Apr 28, 2010 13:43
by CrazyEddie
You didn't mention text in the original post, and it appeared you were referring to window alignment - which is why you got the information you did.

With this new information, the rest of your OP makes a bit more sense now. Looking back at that briefly, it should have worked ok except that the initial value you specified in the PropertyDefinition is spelt incorrectly. The correct spelling is "CentreAligned".

CE.

Re: HorzAlignmentProperty

Posted: Wed Apr 28, 2010 19:03
by Jamarr
wtb aliases for property-values so us American-English spellers can stop fumbling over this issue :cry:

Re: HorzAlignmentProperty

Posted: Thu Apr 29, 2010 09:21
by CrazyEddie
While I'm not completely opposed to such a thing for the built in property enumeration strings, I would not, however, be happy to extend that to all property names, xml tag names and such, because doing that puts us on something of a slippery slope (next request becomes event names, then API names and so on...). Because of this situation, we would end up with a lot of inconsistency where American English works in some places and not others - at least right now it generally does not work anywhere, so while not ideal for everyone, it is consistent ;)

CE.