3 Replies Latest reply on Aug 6, 2009 11:57 AM by cdman522

    TextInput in List, is it a Bug?

    cdman522 Level 1

      Hi all,

       

      I need to have a TextInput inside a List component because I want the user to be able to change the name of the list item while viewing it. The problem is that the spacebar doesn't get captured. In other words a TextInput in a list works fine untill you want a space in what ever you are typing.

       

      Can anyone offer a suggestion on how to fix this or get around it?

       

      Thanks

       

       

      Here's the code I'm using.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication 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 id="list" >
              <s:itemRenderer>
                  <fx:Component>
                      <s:ItemRenderer>
                          <s:states>
                              <s:State name="normal" />
                              <s:State name="hovered" />
                              <s:State name="selected" />
                          </s:states>                   
                          <s:TextInput id="nameLabel" text="{data.lastName}, {data.firstName}"/>                   
                      </s:ItemRenderer>
                  </fx:Component>
              </s:itemRenderer>
              <s:dataProvider>
                  <s:ArrayList>
                      <fx:Object firstName="Ann"  lastName="Green" />
                      <fx:Object firstName="Tom"  lastName="Smith" />
                      <fx:Object firstName="John" lastName="Black" />
                      <fx:Object firstName="Jane" lastName="White" />
                      <fx:Object firstName="Bill" lastName="Jones" />
                  </s:ArrayList>
              </s:dataProvider>
          </s:List>
      </s:WindowedApplication>

        • 1. Re: TextInput in List, is it a Bug?
          cdman522 Level 1

          Update,

           

          If I create my own list that extends the SDK's list and if I override the findKey function so it looks like this:

           

          override protected function findKey(eventCode:int) : Boolean
                  {
                      var tmpCode:int = eventCode;
                 
                      return tmpCode >= 32 &&
                         tmpCode <= 126 &&
                         findString(String.fromCharCode(tmpCode));
                  }

           

          instead of this:

          override protected function findKey(eventCode:int) : Boolean
                  {
                      var tmpCode:int = eventCode;
                 
                      return tmpCode >= 33 &&
                         tmpCode <= 126 &&
                         findString(String.fromCharCode(tmpCode));
                  }

           

          Then using the space bar in the text input in the list works.

          • 2. Re: TextInput in List, is it a Bug?
            Peter deHaan Level 4

            cdman,

             

            Interesting. Can you please file a bug at http://bugs.adobe.com/flex/ and somebody can take a look.

             

            Peter

            • 3. Re: TextInput in List, is it a Bug?
              cdman522 Level 1

              Bug submitted SDK-22598

               

              Another interesting point is that it works fine in a Web project it's only when the project is AIR based that I have experienced this problem.