(SOLVED) StaticText - not wrapping but cutting

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

Savail
Quite a regular
Quite a regular
Posts: 50
Joined: Wed Jul 04, 2012 07:54

(SOLVED) StaticText - not wrapping but cutting

Postby Savail » Fri Oct 26, 2012 18:27

Hey,
I'm not sure but I might have found a bug or I'm doing something incorrectly. So here's my static text lookNfeel code:

Code: Select all

<!--
    ***************************************************
        Game/StaticText
    ***************************************************
    -->
    <WidgetLook name="Game/StaticText">
      <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
      <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
        <Property name="FrameEnabled" value="False" />
        <Property name="BackgroundEnabled" value="False" />
        <NamedArea name="WithFrameTextRenderArea">
            <Area>
                <Dim type="LeftEdge" >
         <ImageDim imageset="Game" image="StaticTopLeft" dimension="Width" >
            <DimOperator op="Subtract">
               <AbsoluteDim value="10" />
            </DimOperator>
         </ImageDim>
          </Dim>
         <Dim type="TopEdge" >
            <ImageDim imageset="Game" image="StaticTop" dimension="Height" >
            
            </ImageDim>
         </Dim>
         <Dim type="RightEdge" >
            <UnifiedDim scale="1" type="RightEdge">
               <DimOperator op="Subtract">
                  <ImageDim imageset="Game" image="StaticTopRight" dimension="Width" >
                     <DimOperator op="Subtract">
                        <AbsoluteDim value="15" />
                     </DimOperator>
                  </ImageDim>
               </DimOperator>
            </UnifiedDim>
         </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaHScroll">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
                <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaVScroll">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
                <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaHVScroll">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
                <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderArea">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
                <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaHScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaVScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaHVScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <Child  type="Game/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
            </Area>
            <VertAlignment type="BottomAligned" />
        </Child>
        <Child  type="Game/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
            </Area>
            <HorzAlignment type="RightAligned" />
        </Child>
        <StateImagery name="Enabled" />
        <StateImagery name="Disabled" />
        <StateImagery name="EnabledFrame">
            <Layer>
                <Section look="Game/StaticShared" section="frame" />
            </Layer>
        </StateImagery>
        <StateImagery name="DisabledFrame">
            <Layer>
                <Section look="Game/StaticShared" section="frame" />
            </Layer>
        </StateImagery>
        <StateImagery name="WithFrameEnabledBackground">
            <Layer>
                <Section look="Game/StaticShared" section="background" />
            </Layer>
        </StateImagery>
        <StateImagery name="WithFrameDisabledBackground">
            <Layer>
                <Section look="Game/StaticShared" section="background" />
            </Layer>
        </StateImagery>
        <StateImagery name="NoFrameEnabledBackground">
            <Layer>
                <Section look="Game/StaticShared" section="background_noframe" />
            </Layer>
        </StateImagery>
        <StateImagery name="NoFrameDisabledBackground">
            <Layer>
                <Section look="Game/StaticShared" section="background_noframe" />
            </Layer>
        </StateImagery>
    </WidgetLook>


and when I'm trying to display some static text with such property set:

Code: Select all

MyText->setProperty("HorzFormatting", "WordWrapLeftAligned");

the word wrapping works but it doesn't seem to calculate correctly the area of rendering text becouse in lookNfeel above I'm substracting from my right dimension some value. In some places my text is just cut, not wrapped to next line. But setting right dimension to unified dim = 1 without substracting anything makes the text is wrapped correctly but it doesn't suit its frame then :(. Here's picture:
Image
Cegui.log:

Code: Select all

26/10/2012 20:01:01 (Std)    * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
26/10/2012 20:01:01 (Std)    ********************************************************************************
26/10/2012 20:01:01 (Std)    ---- Version 0.7.8 (Build: Aug  9 2012 Microsoft Windows MSVC++ 10.0 32 bit) ----
26/10/2012 20:01:01 (Std)    ---- Renderer module is: CEGUI::Direct3D9Renderer - Official Direct3D 9 based 2nd generation renderer module. ----
26/10/2012 20:01:01 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
26/10/2012 20:01:01 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
26/10/2012 20:01:01 (Std)    ---- Scripting module is: None ----
26/10/2012 20:01:01 (Std)    ********************************************************************************
26/10/2012 20:01:01 (Std)    * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *


I will be very grateful if you could find some time to look up this problem!
Last edited by Savail on Sun Oct 28, 2012 10:15, edited 1 time in total.

Savail
Quite a regular
Quite a regular
Posts: 50
Joined: Wed Jul 04, 2012 07:54

Re: Word wrapping in static text - not wrapping but cutting

Postby Savail » Sun Oct 28, 2012 10:15

hmm I don't know what, but something was wrong in my StaticText lookNfeel code. I replaced it with basic TaharezLook/StaticText code and just changed graphics and dimensions and turned out that everything works fine! Couldn't find the issue in my own StaticText code but now everything's alright.
Thanks a lot for anyone taking time on this thread and sorry for any trouble!
Keep up the good job with CeGUI!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests