5 Replies Latest reply on May 24, 2011 5:43 PM by William Spence

    Highlight issue using FocusManager

    William Spence Level 1

      I writing an AIR application and when it gets to a certain state, there is a form to be filled in.  When it arrives at that state, I want the cursor to be waiting at a textInput for the user.  I am using focusManager.setFocus() to make it set focus to the appropriate spot, and it is placing the cursor there for me just as I was hoping.  BUT, it is not highlighting the textInput window with a highlight border the way that I was expecting it to.  When you move to another textInput, it highlights the window, and if you come back to my original textInput, it highlights the window as well.  It is only not highlighting the window using setFocus.  I have set the highlight color to a light blue, and it works when using a mouse to set the focus, but not using the setFocus method.  Here is the code:




           protected function TitleInit(event:FlexEvent):void


                focusManager.setFocus(this.vTitle); //set focus to the first text input box






      <s:TextInput id="vTitle" x="744.5" y="12" width="230" height="26" fontFamily="MyriadPro-Regular"

                 fontSize="16" contentBackgroundColor="#C8C8C8" color="#000000" focusColor="#00BDFF"

                 borderVisible="false" paddingLeft="6" maxChars="25" skinClass="skins.VideoSkins.Video.textInputSkin"/>


      Any help would be appreciated.



        • 1. Re: Highlight issue using FocusManager
          Flex harUI Adobe Employee

          When the cursor is blinking but it is not highlighted, does the window look

          activated?  If you click where the cursor is blinking does the highlight

          show up?

          • 2. Re: Highlight issue using FocusManager
            William Spence Level 1

            No, it does not look activated while the cursor is blinking, and if you click directly in the textInput box the highlight does not appear which makes it seem that it is not activated.  But strangely enough, if you start typing on the keyboard, the text does get input just fine.  If you click on another part of the form and then click back on this textInput, then the highlight DOES appear making it look activated.

            • 3. Re: Highlight issue using FocusManager
              Flex harUI Adobe Employee

              Can you post a 20-line test case?

              • 4. Re: Highlight issue using FocusManager
                William Spence Level 1

                Ok, now I am really a little baffled. I tried to make you a 20-line case to show my issue, but in my 20-line case, it worked just fine. I simply created a WindowedApplication, put a textInput into it, and a creationcomplete handler for the application that uses the focusManager to set focus on the textInput, and it worked beautifully. I then thought that it might have something to do with the fact that I put it in the application level in my 20-line case, and in my program, it is in a component. So in the 20-line case, I put the textInput into a component and then placed the component into the application - and it still worked beautifully. So, I cannot recreate a 20-line case where the issue is happening. So why would it happen in my application? Should I try deleteing everything, save the application, and then enter it again from scratch? This is a very large application, is it possible that one of my import statements is importing a class that conflicts with textInput or the focusManager? Any thoughts at all?




                • 5. Re: Highlight issue using FocusManager
                  William Spence Level 1

                  I think I may have found the solution for anyone who is following.  In the form that I have placed the textInput, there is also a dropDownList that is being populated from a web SQL database that uses a Flex Service and a Call Responder, and populating this list takes a little bit of time.  I was asking the focusManager to put focus on the textInput at the components creation complete, but I think that populating the dropDownList was affecting the focusManagers ability to put focus there.  In other words, I think that the dropDownList was "stealing" focus.  What I did was to make the focusManager wait until the list was populated before it set focus to the textInput, and it worked like a charm.  Thanks for the help!