2 Replies Latest reply on Oct 27, 2009 10:36 AM by injpix

    spark.components.List...how to wordWrap?

    injpix Level 3

      How can I wordWrap text in a spark List component?  I understand that I can wordWrap a mx List component by using the wordWrap and variableRowHeight properties, but I want to use a spark List component.

       

      Thanks.

        • 1. Re: spark.components.List...how to wordWrap?
          Peter deHaan Level 4

          @myIP,

           

          In your Spark List, create a VerticalLayout and set the horizontalAlign property to "justify" (the default is contentJustify).

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/halo">

              <s:List width="150" left="20" top="20">
                  <s:layout>
                      <s:VerticalLayout gap="0" horizontalAlign="justify" />
                  </s:layout>
                  <s:dataProvider>
                      <s:ArrayList>
                          <fx:Object label="Lorem ipsum dolor sit amet, consectetur adipiscing elit." />
                          <fx:Object label="Fusce pulvinar nisi ac leo rhoncus nec malesuada arcu accumsan." />
                          <fx:Object label="Sed at metus eu mauris malesuada ornare." />
                          <fx:Object label="Vestibulum et ante non arcu facilisis sagittis." />
                          <fx:Object label="Praesent euismod bibendum tortor, pharetra pharetra nibh ultricies convallis." />
                          <fx:Object label="Sed at mi quis urna lobortis mattis." />
                          <fx:Object label="Nulla aliquet ante nec nisi auctor et pharetra leo blandit." />
                      </s:ArrayList>
                  </s:dataProvider>
              </s:List>

          </s:Application>

           

          Peter

           

          PS: I also posted a slightly modified version at http://blog.flexexamples.com/2009/10/27/setting-word-wrapping-on-a-spark-list-control-in-f lex-4/.

           

          Message was edited by: Peter deHaan (Adobe)

          • 2. Re: spark.components.List...how to wordWrap?
            injpix Level 3

            Ahhh...that works great!  Thanks again Peter.