Page 1 of 1

[SOLVED] Horizontally Centred Text/Numbers for Spinner

Posted: Thu May 10, 2012 15:38
by BrightBit
Hi CEGUI community,

I want the text/numbers of my spinner to be horizontally centered. Since the corresponding area is an EditBox I thought setting its TextFormatting property to HorzCentred would do the job but it doesn't. Is there any other way to align the text (xml based solutions preferred)?

Entry in looknfeel:

Code: Select all

<WidgetLook name="Widgets/Spinner">
   <Child  type="Widgets/EditBox" nameSuffix="__auto_editbox__">
      <Area>
         <!-- commented out for simplicity -->
      </Area>
   </Child>
   <Child  type="Widgets/TemplateButton" nameSuffix="__auto_incbtn__">
      <Area>
         <!-- commented out for simplicity -->
      </Area>
      <HorzAlignment type="RightAligned" />
      <Property name="NormalImage" value="set:Widgets image:IncreaseButtonNormal" />
      <Property name="HoverImage" value="set:Widgets image:IncreaseButtonNormal" />
      <Property name="PushedImage" value="set:Widgets image:IncreaseButtonPushed" />
      <Property name="DisabledImage" value="set:Widgets image:IncreaseButtonDisabled" />
   </Child>
   <Child  type="Widgets/TemplateButton" nameSuffix="__auto_decbtn__">
      <Area>
         <!-- commented out for simplicity -->
      </Area>
      <HorzAlignment type="RightAligned" />
      <Property name="NormalImage" value="set:Widgets image:DecreaseButtonNormal" />
      <Property name="HoverImage" value="set:Widgets image:DecreaseButtonNormal" />
      <Property name="PushedImage" value="set:Widgets image:DecreaseButtonPushed" />
      <Property name="DisabledImage" value="set:Widgets image:DecreaseButtonDisabled" />
   </Child>
   <StateImagery name="Enabled" />
   <StateImagery name="Disabled" />
</WidgetLook>

Entry in scheme file:

Code: Select all

<FalagardMapping WindowType="Widgets/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="Widgets/Spinner" />

Entry in layout file:

Code: Select all

<Window Type="Widgets/Spinner" Name="Spinner" >
   <Property Name="UnifiedPosition" Value="{{0,8},{0,150}}" />
   <Property Name="UnifiedSize" Value="{{0,155},{0,50}}" />
   <AutoWindow NamePath="__auto_editbox__" >
      <Property Name="TextFormatting" Value="HorzCentred" /> <!-- THIS DOESN'T WORK! This will throw an UnknownObjectException -->
   </AutoWindow>
</Window>


EDIT: I am using CEGUI 0.7.7 (from source)

Greetings
BrightBit

Re: Horizontally Centred Text/Numbers for Spinner

Posted: Mon May 14, 2012 10:50
by CrazyEddie
For 0.7.x, the AutoWindow attribute uses NameSuffix and not NamePath (though that is used in ustable - 9999.0 version)

CE.

Re: Horizontally Centred Text/Numbers for Spinner

Posted: Mon May 14, 2012 12:57
by BrightBit
Thank you. That actually did the tick.