[SOLVED] Horizontally Centred Text/Numbers for Spinner

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
BrightBit
Not too shy to talk
Not too shy to talk
Posts: 35
Joined: Mon May 30, 2011 03:30
Contact:

[SOLVED] Horizontally Centred Text/Numbers for Spinner

Postby BrightBit » Thu May 10, 2012 15:38

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
Last edited by BrightBit on Sat May 26, 2012 22:06, edited 1 time in total.
"Yeah so if you ever need info about anyone [...] Just ask. [...] They 'trust me'. Dumb fucks." - Mark Zuckerberg (Facebook CEO)

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

Re: Horizontally Centred Text/Numbers for Spinner

Postby CrazyEddie » Mon May 14, 2012 10:50

For 0.7.x, the AutoWindow attribute uses NameSuffix and not NamePath (though that is used in ustable - 9999.0 version)

CE.

User avatar
BrightBit
Not too shy to talk
Not too shy to talk
Posts: 35
Joined: Mon May 30, 2011 03:30
Contact:

Re: Horizontally Centred Text/Numbers for Spinner

Postby BrightBit » Mon May 14, 2012 12:57

Thank you. That actually did the tick.
"Yeah so if you ever need info about anyone [...] Just ask. [...] They 'trust me'. Dumb fucks." - Mark Zuckerberg (Facebook CEO)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 17 guests