3 Replies Latest reply on Feb 12, 2010 10:54 AM by Flex harUI

    popUp that implements IFocusManagerContainer has its own FocusManager, how to control the focus?

    JabbyPandaUA Level 3

      Hi all,


      Have a look at the sample code to ilustrate the problem:


      This application includes 2 set of groups with TextInputs controls that display popups by the help of PopUpAnchor control:



      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  paddingLeft="10" paddingTop="10" paddingRight="10">                
          <s:Group id="gr1">
              <s:TextInput id="inputTxt"
                           change="{frmPUA.displayPopUp = true}"/>                                    
              <s:PopUpAnchor id="frmPUA" popUpPosition="below"                            
                  <s:List id="list" width="100">            
                                  <fx:Object label="Application" />
                                  <fx:Object label="BorderContainer" />
                                  <fx:Object label="Button" />
                                  <fx:Object label="ButtonBar" />
                                  <fx:Object label="ButtonBarButton" />
                                  <fx:Object label="CheckBox" />                        
          <s:Group id="gr2">                    
              <s:TextInput id="inputTxt2"
                           change="{frmPUA2.displayPopUp = true}"/>                                
              <s:PopUpAnchor id="frmPUA2" popUpPosition="below"                            
                  <s:Button label="Some button">


        After I insert the first symbol into first TextInput, TextInput loses system focus and then the focus is transferred to <s:List> component displayed via PopUpAnchor component.


      This happens because <s:List> component implements IFocusManagerContainer interface, thus popUp property of  PopUpAnchor  has its own FocusManager and it "steals" the focus.


        I would like to prevent this "stealing" focus behaviour.


        I would like the blinking cursor to remain inside TextInput control as long as I type the text inside this control,  like the behaviour one can witness when entering the text into the second TextInput, <s:Button> control is displayed via PopUpAnchor, but the focus remains inside TextInput.


      How can I achieve that?