2 Replies Latest reply on May 9, 2011 6:36 AM by Sean@Tier1CRM

    Spark TextInput cursor disappearing on opening of a List control (possible bug?)

    Sean@Tier1CRM

      I'm currently trying to build a custom component that will be opening up a list control on change of a text input. I've noticed some odd behaviour, I assume this is a bug but I'm looking to see if there are any possible workarounds.

       

      Here's a basic test application to test my scenario:

       

      <?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/mx" minWidth="955" minHeight="600"
                        creationComplete="application1_creationCompleteHandler(event)">
           <fx:Script>
                <![CDATA[
                     import mx.events.FlexEvent;
                     import mx.managers.PopUpManager;
                     
                     import spark.components.List;
                     import spark.events.TextOperationEvent;
                     
                     private var _list:List;
                     
                     protected function textinput1_changeHandler(event:TextOperationEvent):void
                     {
                          if (testTextInput.text == 'a')
                          {
                               if (!_list.isPopUp)
                               {
                                    PopUpManager.addPopUp(_list, this);
                               }
                               _list.visible = true;
                               var point:Point = testTextInput.localToGlobal(new Point(0,0));
                               _list.x = point.x;
                               _list.y = point.y + testTextInput.getExplicitOrMeasuredHeight();                         
                          }
                          else
                          {
                               _list.visible = false;
                          }
                     }
      
      
                     protected function application1_creationCompleteHandler(event:FlexEvent):void
                     {
                          _list = new List();                    
                          _list.width = testTextInput.getExplicitOrMeasuredWidth();
                     }
      
                ]]>
           </fx:Script>
           <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) here -->
           </fx:Declarations>
           <s:TextInput id="testTextInput" change="textinput1_changeHandler(event)" />     
      </s:Application>
      
      

       

       

      Pretty simple, if you type a only it will show the list, type anything else and it will hide the list.

       

      Now here's the thing, when I type the letter a, the list opens successfully, however the cursor on the text input disappears. It's odd cause the text input still has focus, and you can continue to type, its just the cursor disappearing. Also, if the list does not open when you continue to type, the cursor re-appears.

       

      I'm not sure what is it about the popping up of a list thats causing the cursor to disappear, but it's rather annoying (considering even selecting the text with shift doesn't show the highlighted text properly). Also, note that if you click the text input again the cursor will re-appear.

       

      Anybody encounter this before? If so is there any possible workaround for this?

       

      Thanks,

      Sean

       

      P.S. Using FLEX SDK 4.1 with FLASH Player 10,0,45,2 (debug) for Windows 7