4 Replies Latest reply on Mar 14, 2011 10:05 PM by Ameya Mogare

    Word wrap for Label Text

    Ameya Mogare Level 1

      Hi,

       

      My label text used is causing scrollbars to appear when label text is somewhat longer.

      Note that the label "<mx:Label   text="{day0[0].dayPart0[1].dayDesc}"/>" is the one which has smaller  and longer texts which is causing scrollbars to apper.

       

      Is there any way to add word wrap to label text? because I want to avoid adjusting the 'width' property of overall application: -

       

      <mx:HBox id="fiveDaysBox" width="100%" height="100%" horizontalGap="0" backgroundAlpha="1">                 

           <mx:Panel id="tomorrowPanel"  title="Tomorrow"  width="100%" height="100%" paddingLeft="0" paddingRight="0"  horizontalAlign="center">
                <mx:Label  width="60%" text="Day:"/>
                <mx:Image  source="{iconSmallPrefix}{day0[0].dayPart0[1].dayIcon}"/>
                <mx:Label  text="{day0[0].dayPart0[1].dayDesc}"/>
                <mx:HRule width="60%"/>
           </mx:Panel>

      </mx:HBox>

       

      Please suggest.

       

      Thansk and regards,

      Amey

        • 1. Re: Word wrap for Label Text
          Nuwan,Chamara Level 1

          Hi,

           

          I think you can use mx:Text to do the word wrapping instead of using mx:Label.

          • 2. Re: Word wrap for Label Text
            Ameya Mogare Level 1

            Hi Nuwan,

             

            I tried to use mx: Text, but there is no property for word-wrap in it.

            Can you please elaborate? or give an example of coding?

             

            Thanks,

            Amey

            • 3. Re: Word wrap for Label Text
              Nuwan,Chamara Level 1

              Hi,

               

              I think if you have some long text in the mx:Text and if you set a specific width for that, it would wrap the text automatically. In the following code the text would be wrapped automatically for the specified width.

               

              <mx:Text text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas auctor sodales nibh sit amet mollis. Suspendisse tortor est, adipiscing eu tincidunt ac, posuere quis dolor. Donec non erat sit amet arcu luctus vehicula sit amet quis ligula. Aliquam id placerat augue. Sed vestibulum, urna nec tempor vehicula, libero enim consequat justo, a pharetra odio sem nec lectus. Sed vitae elit mi, nec viverra orci. Duis diam magna, pretium sed ullamcorper sed, sollicitudin interdum sapien. Morbi tincidunt posuere dignissim. Suspendisse massa dui, imperdiet eu condimentum et, tincidunt vitae leo. Curabitur consequat purus vel ante volutpat tempus. Donec molestie venenatis dolor, ut tincidunt lacus scelerisque nec. Sed magna eros, tempus et pretium in, interdum vel ligula. Mauris eu ligula elit. Phasellus varius iaculis libero vitae porttitor. Phasellus tincidunt, leo eget facilisis laoreet, quam enim lacinia enim, non sagittis dolor libero at felis. Etiam ac est ac mi eleifend pharetra. Aenean convallis risus ac lorem ornare quis ullamcorper erat sagittis."

               

              width="100" />

              • 4. Re: Word wrap for Label Text
                Ameya Mogare Level 1

                Thank you Nuwan!

                It solved my purpose.