2 Replies Latest reply on Aug 13, 2006 10:46 PM by jpwrunyan

    tabindex problems in flex 2.0

      We are developing a RIA application using Flex 2.0.
      I am encountering problems using the tab index. Even if i set the tablndex property for the controls, it doesnot follow the sequence.
      I also tried using the focusout event on the control to explicitly set the focus on to the item. But that is also giving problem.
      Could anybody help in fixing the tabindex to go in the customised sequence which i set.
      Will just giving the tabindex will not work?
      Pls. help asap.
        • 1. Re: tabindex problems in flex 2.0
          Doesn't this work?:

          myTabs.selectedIndex=0, myTabs.selectedIndex=1, etc.

          Or am I oversimplifying what you need?

          Do you have any code examples of what you are trying to do?
          • 2. Re: tabindex problems in flex 2.0
            jpwrunyan Level 1
            There is a problem with setting tabIndex. Part of the problem is that the default value (-1) comes before any other setable value.

            This alone is not a problem for simple scenarios. If you set the tabIndex of one component on a screen, you probably set it for all the sibling components as well.

            Now mix into the bag custom components (particularly ones with changing states that add/remove controls).
            The problem is when you have custom components that use a tabIndex for their "internal" controls, but you don't use a tabIndex for the controls that exist as siblings to the custom component itself:

            <mx:TextInput id="mainText" />
            <common:CustomForm id="customForm">
              <mx:TextInput tabIndex="1" id="subText1" />
              <mx:TextInput tabIndex="2" id="subText2" />
            <mx:TextInput id="mainText2" />
            <mx:Button label="submit" />

            In this scenario, the tab focus moves from mainText -> mainText2 -> submit Button -> subText1 -> subText2
            because... mainText, mainText2, and the submit Button all have tabIndices of -1 which comes before 1 and 2. Flex 2.0 quite presumptively ignores the fact that subText1 and subText2 are tab children of the form component. This is not the way it worked in Flex 1.5 and is a very frustrating problem. You could solve the problem above by setting the tabIndex of mainText to 0, mainText2 to 3, and the Button to 4 but then, what will you do when you use the custom form component in another file with different controls? What will you do if you need to add another TextInput in front of mainText?

            The end result is that you cannot use tabIndex in custom components for probably 90% of all flex projects (and the remaining 10% are probably so simple you don't NEED to use tabIndex). One step forward for Flex version number, two steps back for developers.

            thus ends the sad, sad tale of tabindex problems in flex 2.0