Wrap long lines in a Spark List component?

I have a Spark List. 
The text for each entry is on one line, and is too long to fit.
Can I get it to break to as many lines as needed without a custom item renderer?

If you define an explicit width on the SimpleText in the DefaultItemRenderer you can get this behavior.
Here is an example of this using an inline ItemRenderer:
<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="50" height="200">
        <s:ArrayList>
            <fx:String>a</fx:String>
            <fx:String>b</fx:String>
            <fx:String>c c c c c c c c c c c c</fx:String>
            <fx:String>d</fx:String>
            <fx:String>e</fx:String>
        </s:ArrayList>
        <!-- here we define a custom item renderer inline (copied and modified from DefaultItemRenderer.mxml) -->
        <s:itemRenderer>
            <fx:Component>
                <s:ItemRenderer focusEnabled="false">
                    <fx:Script>
                        <![CDATA[
                            override public function set label(value:String):void
                                super.label = value;
                                labelDisplay.text = label;
                        ]]>
                    </fx:Script>
                    <s:states>
                        <s:State name="normal" />           
                        <s:State name="hovered" />
                        <s:State name="selected" />
                        <s:State name="normalAndShowsCaret"/>
                        <s:State name="hoveredAndShowsCaret"/>
                        <s:State name="selectedAndShowsCaret"/>
                    </s:states>
                    <s:Rect left="0" right="0" top="0" bottom="0">
                        <s:stroke.normalAndShowsCaret>
                            <s:SolidColorStroke
                                color="{selectionColor}"
                                weight="1"/>
                        </s:stroke.normalAndShowsCaret>
                        <s:stroke.hoveredAndShowsCaret>
                            <s:SolidColorStroke
                                color="{selectionColor}"
                                weight="1"/>
                        </s:stroke.hoveredAndShowsCaret>
                        <s:stroke.selectedAndShowsCaret>
                            <s:SolidColorStroke
                                color="{selectionColor}"
                                weight="1"/>
                        </s:stroke.selectedAndShowsCaret>
                        <s:fill>
                            <s:SolidColor
                                color.normal="{contentBackgroundColor}"
                                color.normalAndShowsCaret="{contentBackgroundColor}"
                                color.hovered="{rollOverColor}"   
                                color.hoveredAndShowsCaret="{rollOverColor}"
                                color.selected="{selectionColor}"
                                color.selectedAndShowsCaret="{selectionColor}"
                                />
                        </s:fill>
                    </s:Rect>
                    <!-- the only real change is to set a specific size on the SimpleText slightly smaller
                         than the width of the List to account for the border -->
                    <s:SimpleText id="labelDisplay" verticalCenter="0" width="48" top="6" bottom="4"/>
                </s:ItemRenderer>
            </fx:Component>
        </s:itemRenderer>
    </s:List>
</s:Application>

Similar Messages

  • Paging data in Spark list component

    I'm wondering if paging data for Spark list components will be available in the final release of FB 4 / Flex SDK 4? Currently you will get an error when trying to bind a paged service method to a Spark list component: "Paged operations are not supported by this component".
    I'm asking this because of some problems we currently have with paging data in a Flex 3 TileList. See Jira issue: http://bugs.adobe.com/jira/browse/SDK-18758
    The suggested solution in this issue is to use a Gumbo Spark TileLayout instead of a TileList. That's currently not a suitable solution since the list doesn't support paging...

    Hi Jacob and Ram,
    Thank you for the information. Not the type of info I was hoping for of course . Do you guys know what I have to do to re-open my bug report (http://bugs.adobe.com/jira/browse/SDK-18758)? I'd really like to have the Halo TileList fixed so we are able to use it properly.
    Thanks,
    Jaap

  • Firefox 4 does not wrap long lines.

    Firefox 4 is not wrapping long lines for www.lindasgourmetcookies.com. This worked in previous versions of Firefox. See "URL of affected site" for an example. Lines also wrap properly on IE

    There are a lot of typos in the CSS file: ';' instead of a ':' (font-size<u>;</u> 12px;), so you want to fix that first.<br />
    See the Tools > Error Console (Firefox > Web Developer)
    <pre><nowiki>.choicesbox2 a:visited {color:#0000bb; font-size; 12px;}
    .choicesboxl a:visited {color:#0000bb; font-size; 12px;}
    </nowiki></pre>
    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.<br />
    You need to register at the mozillaZine forum site in order to post at that forum.<br />
    See http://forums.mozillazine.org/viewforum.php?f=25

  • How wrap long lines in incoming mail

    Some email arrives with VERY long lines, and so are clumsy to read. Is there a way to cause TB to wrap them to a specified length?

    I thought that that point might be raised [hoped it wouldn't], and yes, if I were sending these instructions to the average user I'd do exactly that. In this case, the recipients are likely not skilled enough to deal with attachments and possibly not equipped to open them.
    Really, having created a formatted document in another application AND then wanting to copy it intact into an email, you'd think there'd be a reason.
    "Yours is not to wonder why; yours is but to do or die" [answer or die :D]
    And this part of the discussion wouldn't even have to be had if the rewrap advice were given as 'text wrapping in plain text emails' [careful, this deletes your formatting and images]. I found out the hard way that the rewrap wouldn't help with html.
    Incidentally, anyone creating content in Word or similar might consider pasting it into an html editor and checking for the presence of non-breaking spaces ( & n b s p ; ) that stymie line wrapping.

  • Can you disable the spark list component?

    i need to disable the spark list in my application when the user clicks on new story... is that possible?

    Set the Boolean enabled property to false.
    <?xml version="1.0"?>
    <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/mx">
        <s:controlBarContent>
            <s:CheckBox id="ch" label="enabled" selected="true" />
        </s:controlBarContent>
        <s:List id="lst" enabled="{ch.selected}" horizontalCenter="0" verticalCenter="0">
            <s:dataProvider>
                <s:ArrayList source="[One,Two,Three,Four,Five,Six,Seven,Eight]" />
            </s:dataProvider>
        </s:List>
    </s:Application>
    Peter

  • Horizontal line between rows in List component

    Hi,
    How to draw lines between rows in ListBase components?
    (something like verticalGidLines in DataGrid component).
    I know how to customize mouse-hover and selection boxes in a
    ListBase components,
    example:
    Vista Start
    Menu
    Thanks,
    Mariosh

    I tried the invalidate method as follows but nothing happened:
    mylist.invalidate();
    Not sure if I explained myself well, I just want the horizontal scrollbar to appear and be able to move it when one or more items in the list are long and thus not all visible...thanks

  • Option to automatically re-wrap long lines

    On some USENET posts, when reading, I get the original message in one long continuous line. I believe this is because it has been posted in HTML (might be wrong ....).
    I know CTRL-R will re-wrap it to something more sensible, but I cannot find anything that looks revelant in Tools|Options to set this behaviour by default. Also I *don't* want to re-wrap other posts that do behave normally.
    Am I missing something, or is this a potential feature ?
    cheers
    geoff

    I'm not aware of such an extension, but you can do something similar with Find and Replace (assuming that the content is "pure" text, that is without html tags within the text).
    1. Select the text you want to work with.
    2. Open the Find and Replace dialog (CTRL+F).
    3. Choose "Selected Text" in the "Find in" list
    4. In "Find" enter (change 10 to whatever number you want to break after):
    ([\w\W]{10})
    5. In "Replace" enter:
    $1<br />
    6. At the end of the replace text, hit SHIFT+Enter if you want to have a acual line break inserted after the BR tag
    7. Check the "Use Regular Expression"  box.
    8. Click the "Replace All" button.

  • Spark list horizontal scroller doesn't actualize when rows is set lesser than list container

    Hello,
    The size of the Image control is set larger than that of its parent Group  container. By default, the child extends past the boundaries of the parent  container. Rather than allow the child to extend past the boundaries of the  parent container, the Scroller specifies to clip the child to the boundaries and  display scroll bars.
    In the spark list, when I change the list dataProvider and the size of the Image control is set lesser than that of its parent Group  container, the horizontal scroller doesn't actualize.
    thanks.

    <!-- Simple example to demonstrate the Spark List component -->
    <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/mx" applicationComplete="comp()" width="260" height="400">
        <fx:Script>
            <![CDATA[
        import mx.collections.*;
        public var dpArray:Array;
        [Bindable]
        public var dpCol:ArrayCollection;
        public function handleClick():void {
            dpCol.removeAll();
            dpCol.addItem({ label:"spark test" });
            dpCol.addItem({ label:"spark text" });
        public function comp():void {
            dpCol = new ArrayCollection(dpArray);
            dpCol.addItem({ label:"spark list horizontal scroller doesn't actualize when rows is set lesser than list container" });
            dpCol.addItem({ label:"spark test" });
            dpCol.addItem({ label:"spark text" });
             ]]>
        </fx:Script>
        <s:Panel title="List">
            <s:VGroup left="20" right="20" top="20" bottom="20">
                <s:List width="200" id="lis" dataProvider="{dpCol}" height="120"/>
                <s:Button id="button1" label="Click here!" width="100" fontSize="12" click="handleClick();"/>
            </s:VGroup>
        </s:Panel>
    </s:Application>

  • Extending a component which already extends a spark list ItemRenderer

    Hello everyone,
    I have the following situation: Im displaying lists of very similar data objects (they extend the same parent) so in order to avoid a lot of changes to many itemrenderers (if i need to change something in the common properties) when displaying this data, i defined a spark list ItemRenderer (in MXML) which displays the common properties (file called BaseRenderer.mxml):
    <s:ItemRenderer>
         //in the script section i override the set data property
         //some MXML labels, checkboxes, etc
    </s:ItemRenderer>
    Then i created a specific itemrenderer which extended it (file SpecificRenderer.mxml):
    <model:BaseRenderer>
         //again i override the set data property
         //some ADITIONAL MXML labels, checkboxes, etc
    </model:BaseRenderer>
    When i run the app, and when the specific renderer is used, it works (no errors are thrown) , but it only shows the content of specific renderer, nothing from base renderer is visible. Is this the right way to do this, or do i have to override some additional stuff in my specific renderers?
    Thank you.
    One more thing, i just noticed, if i remove all MXML tags from specific renderer, the content from base renderer becomes visible, seems as if specific content overrides base content. Is there a way to add mxml tags into the specificrenderer?

    Yes i suspected them to be merged, and you gave me a great idea. As you say this behavior is true across all mxml defined components, not just itemrenderers. I want to avoid actionscript renderers because i dont (and wont) have any performance issues anyway and i like flexibility in design view, so instead i found another solution which i slightly modified. Some spark components inherit property mxmlContent, which you can override. This is what i came up with in the end: I added the property override into specific renderer and everything is shown as expected (because base elements are merged with the ones from extended component).
    override public function set mxmlContent(value:Array):void {
                                            var adding:Boolean = true;
                                            var index:int = 0;
                                            while (adding) {
        var element:IVisualElement = null;
        try {          element = super.getElementAt(index); } catch(e:Error) {          }
        if ( element != null )  {
           value.push(element);
           index += 1;
        else
          adding = false;
                                            value.reverse();
                                            super.mxmlContent = value;

  • Horizontal grid lines color in a spark List

    Hello,
    How to change horizontal grid lines color in a spark List using css
    Thanks

    Hello,
    How to change horizontal grid lines color in a spark List using css
    Thanks

  • Bash: wrapping long command line [SOLVED]

    I'm trying to configure my bash to wrap long command lines.  I am looking for a behaviour similar to tcsh where, at the border of the window,  the command is continued on the next line.  In bash, the command continues at the begining of the same lines wich is messy.  I tried using
    set horizontal-scroll-mode on
    in my ~/.inputrc but the continuation doesn't start at the windows border. I can post screenshots if that would help.
    Thanks.

    putting the line in .bashrc have no effect.
    Here is my .bashrc
    export EDITOR=emacs
    export PAGER=less
    export LESS="-f -r"
    export BROWSER=firefox
    PS1='[33[01;34m]#[33[00m] 33[01;31m]u@H[33[00m]33[01;39m] w $33[00m] '
    # create an xauth key for root user
    umask 377
    /usr/X11R6/bin/xauth extract /tmp/user.xauth $DISPLAY
    umask 022
    #set horizontal-scroll-mode on
    source ~/.aliases
    my .bash_profile
    . $HOME/.bashrc
    my .inputrc
    "e[A": history-search-backward
    "e[B": history-search-forward
    set show-all-if-ambiguous on
    set page-completions off
    set completion-query-items 10000
    set horizontal-scroll-mode on
    The screenshots:
    With tsch (what I'm looking for)
    With set horizontal-scroll-mode off:
    If I continue to press the 'a' key, it overwrite the whole line and wraps at the window border.
    With set horizontal-scroll-mode on:
    It wraps 2 inches before reaching the window border.
    [/img]

  • How to print a text file with long lines?

    I am trying to print a text file which contains many long lines. I find that the long lines are truncated on the printouts. How do I wrap up these long lines? Could you give me some examples?
    Thank you very much!

    Here's an example. The "\n" makes anything after it go to the next line. I hope this helps. Look at the Private void getTable() section.
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    public class LabNine extends Frame implements ActionListener, WindowListener {
         private TextField txtInfo;
         private List lstInfo;
         private Button btnAddInfo;
         private BorderLayout borderlayout;
         private Connection databaseConnection;
         Statement statement;
         ResultSet resultSet;
    public LabNine( ) {
         super("Lab Nine");
         // addWindowListener to close application
         addWindowListener(this);
         // create layout
         borderlayout = new BorderLayout();
         setLayout(borderlayout);
         // create text field so the file input that is selected will be seen in here
         txtInfo = new TextField();
         txtInfo.setEnabled(false);
         Color color = new Color(255, 136, 183);
         txtInfo.setBackground(color);
         add(txtInfo, BorderLayout.NORTH);
         // create list so the file input can be populated in here
         lstInfo = new List();
         add(lstInfo, BorderLayout.CENTER);
         // create button to add selected input file in the text field
         btnAddInfo = new Button("Add Info");
         btnAddInfo.setBackground(Color.cyan);
         btnAddInfo.setFont(new Font("TimesRoman", Font.BOLD, 16));
         btnAddInfo.addActionListener( this );          
         add(btnAddInfo, BorderLayout.SOUTH);
         // set frame attributes
         setSize(450, 250);
         setResizable( false );
         show();
         // get the table/ get the query
         loadConnection();
         getTable();
    public void actionPerformed(java.awt.event.ActionEvent e) {
         // if add button is pushed then it will check to see if an item was selected.
         // if not, then an error message will be displayed else the selected item will be in the text box
         if ( e.getSource() == btnAddInfo ) {
              if ( lstInfo.getSelectedIndex() == -1 ) {
                   System.out.print( "You have not selected an item" );
              else {
                   txtInfo.setText(( lstInfo.getSelectedItem() ));
    private void getTable() {
         try {
              String query = "SELECT FIRST, LAST, EMAIL FROM Names";
              statement = databaseConnection.createStatement();
              resultSet = statement.executeQuery( query );
              while ( resultSet.next() ) {
                   lstInfo.add( resultSet.getString( "FIRST" ) + " " + resultSet.getString( "LAST") + " " +
                        resultSet.getString( "EMAIL" ) + "\n" );
              statement.close();     
         catch ( Exception e ) {
              System.err.println( e );
    private void loadConnection() {
         // define the data source for the driver
         String sourceURL = "jdbc:odbc:people";
         String username = "";
         String password = "";
         // load the driver
         try {
              // load the drive class
              Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
              // create a connection through the drivermanager
              databaseConnection = DriverManager.getConnection( sourceURL , username, password );     
         catch( ClassNotFoundException cnfe ) {
              System.err.println( cnfe );
         catch( SQLException sqle ) {
              System.err.println( sqle );
    public static void main(java.lang.String[] args) {
         LabNine aLabNine = new LabNine( );
    public void windowActivated(java.awt.event.WindowEvent e) {
    public void windowClosed(java.awt.event.WindowEvent e) {
         // closes the application
         System.exit( 0 );
    public void windowClosing(java.awt.event.WindowEvent e) {
         // closes the application
         System.exit( 0 );

  • Spark List in Actionscript: Passing Layout & itemRenderer in constructor

    I am trying to create a generic List, where I can pass the layout & item renderer as parameters.
    Since it is not possible to pass parameters to a MXML component, I figured I should create my List in Actionscript.
    I figured it would go something like this:
    public class GenericList extends List {
       public function GenericList(iR:ItemRenderer, ac:ArrayCollection, layout:LayoutBase) {
         super();
         this.dataProvider = ac;
         this.layout =  ...     // don't even have access to this.layout
         this.itemRenderer = iR // Cannot pass itemRender
    I would prefer to have the List in MXML (because It will be easier using states later), but If I am forced to use pure Actionscript so I can instantiate it and pass in parameters, any help would go a long way.

    hi
    cant you do this to pass in parameters?
    <mx:List dataProvider="{myDP}" layout="{myL}" itemRenderer="{myIR}" .. />
    [Bindable]
    var myDP:ArrayCollection;
    [Bindable]
    var myL:LayoutBase;
    [Bindable]
    var myIR:IFactory;
    function setList(iR:IFactory, ac:ArrayCollection, layout:LayoutBase):void
         myIR = iR;
         myDP = ac;
         myL = layout;
    (spark list expects itemRenderer to be an IFactory instance)

  • Sending/receiving email with long lines of text.

    Using mail with yahoo plus. Composed emails have long lines of text. Recipients complain that they have to scroll left to right to view them. Not so on a PC with Outlook, anyone know of a solution to this. Thanks

    Hi Chris,
    Thanks for the response. No, there were no rules set, but your query gave me ideas. I'd never been in the rules section before, but I played with it for a while with some trial and error and finally made a rule that set all the emails to show with black text, and duplicated it for all the mailboxes, and voila! there were all the emails listed in black text.
    While I'm sure there are more effective ways of writing a rule, my rule worked fine. I had it say that if "any" of the following conditions are met: "From" "Contains" "@", perform the following actions: "Set color" "of text" "Other [black]" and applied it to the mailbox.
    Thanks for the spark of the idea.
    Gail

  • How Do You Populate A Spark List Control With An Array?

    Hello, all,
    Sorry to come accross so frustrated, but how in the name of God do you populate a Spark list control with the data in an array?  You used to be able to do this with the mx:List control, but the guys developing Flex just had to make things more difficult than they need to be!  I am more of a code purist and prefer doing things the way they have been done for decades, but apparently nothing can ever stay simple!
    I simply want to populate a list control with an array and this shouldn't be rocket science!  I found out that I must use a "collection" element, so I decided that an arrayCollection would be best.  However, after searching Adobe's documentation about arrayCollections, I am lost in a black hole of data binding, extra lines of code just to add a new element, the need to sort it, etc...!
    Here is my code:
    var pendingArray:ArrayCollection = new ArrayCollection();
    for ( var i:int = 0 ; i < queue.length ; i++ )
         var item:UserQueueItem = queue[i] as UserQueueItem ;
         if ( item.status == UserQueueItem.STATUS_PENDING )
         pendingArray.addItem({label:item.descriptor.displayName,descriptor:item.descriptor});
    Here is the relevant MXML:
    <s:VGroup>
         <s:List id="knockingList" width="110" height="100"/>              
    </s:VGroup>
    I'm not getting any errors, but the list is not populating.
    I have seen several examples where the arrayCollection is declared and populated in MXML:
            <mx:ArrayCollection id="myAC">
                <!-- Use an fx:Array tag to associate an id with the array. -->
                <fx:Array id="myArray">
                    <fx:Object label="MI" data="Lansing"/>
                    <fx:Object label="MO" data="Jefferson City"/>
                    <fx:Object label="MA" data="Boston"/>
                    etc...
               </fx:Array>
            </mx:ArrayCollection>
    That may be fine for an example, but I think this is a rare situation.  Most of the time I would image that the arrayCollection would be created and populated on the fly in ActionScript!  How can I do this?
    Thanks in advance for any help or advice anyone can give!
    Matt

    In your post it seemed like you were trying to take care of many considerations at once: optimization, design, architecture.  I would suggest you get something up and running and then worry about everything else.
    If I use data binding, then I will probably have to declare the  arrayCollection as a global variable and then I'll have to write 100 or  so extra lines of code to addItem(), removeItem(), sort(), etc...  It  just seems like too much overhead.
    I believe you may have some misconceptions about databinding in general.  You won't have to make it a global variable and you certainly won't need an extra 100 lines of code.  If you did this forum would be a very , very quiet place.
    I don't want to use data binding because the original array is refreshed  often and there is one function called by an event that re-declares the  arrayCollection each time, populates it with the array, and then sets  it as the list's dataprovider.
    That is the beauty of the ArrayCollection, it can handle the updates to its source Array. I don't know if you need to redeclare the ArrayCollection, resetting the source to the new Array allows everyone involved to keep their references so you don't have to worry about any "spooky" stuff going on.

Maybe you are looking for

  • LG G Pad 7 won't turn on

    Same issue...got it for $.99 when I upgraded my phone...YESTERDAY!!! The sales rep totally sold me on it...worked his persuasive magic and within minutes I thought, "Hey! This will be so awesome for Maeve!" My little 4-year old has to constantly argu

  • Is it possible to transfer library information such as play counts, ratings

    I've learned how to transfer my music files to a new PC, but is it possible to also transfer library info such as play counts and ratings? I am moving my music from an old XP system to a Vista system. I would like to keep all my play counts, ratings

  • Publish Bex Workbook to Shared Drive in Windows

    Hello Gurus, I want to schedule Workbook to Shared Drive in Windows. Please let me know If this is possible. Thanks Hemanth

  • Ipad song order is strange, help?

    Hi guys, I have this problem with some albums on my ipad. When i want to play them their track order is via alphabetical order. the funny thing is other albums are not like this so i guess its not just a simple false setting. I have tried updating th

  • WebServices with Synch. process

    Hi Experts, Is this possible like, 1 Sender and 2 Receivers...bothsides are using webservices and the communication is Synchronous processing.. If possible how? if not...why? awaiting your results... Regards, YRaj.