How to reorder tabs in Flex (ActionScript, SDK 3.5)

The order of flexible tabs is important both for ease of use (obviously) and for accessibility (it determines the reading order of readers on the screen). However, Flex 3.5 does not seem to have support to influence it for more complex applications.

From what I know so far:

  • the tab order is calculated using mx.managers.FocusManager, which takes care of one β€œtab cycle” for the entire application (that is, for each container there is no one but one for the entire application). The exceptions are built-in .swf files and pop-ups, each of which has its own FocusManager.

  • the logic inside FocusManager is marked as confidential, and the class is created in Application.initialize (), so it’s not easy to change the behavior (without adding parts of the SDK that may cause license problems)

  • The order of the tabs looks for the tabIndex (int) properties of each component. All components that have this set property (> 0) are sorted by its value, otherwise a visual hierarchy is used (which uses nested containers and a child order inside the containers).

  • All components without tabIndex are sorted after the components that it has installed (inside "tabIndex not set" are mapped to "tabIndex = int.MAX_VALUE"

  • two components with the same tabIndex are ordered by visual hierarchy.

, ( , ), tabIndexes - , , . , : . mxml , , .

:

accVerticalStuff.mxml

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Label text="One"/>
    <mx:TextInput tabIndex="1" id="One" />

    <mx:Label text="Two" />
    <mx:TextInput tabIndex="2" id="Two"/>

    <mx:Label text="Three" />
    <mx:TextInput tabIndex="3" id="Three"/>

</mx:VBox>

Application.mxml                       

: , , . TopLevelElement . ( , tabIndex, tabIndex, , One Three - , )

: , . TopLevelElement ( tabIndex) .

, ( Canvas AutoLayout).

(, , SDK), ?

, Flex4 ?

+5
2

:

  • ( ) DisplayObject tabIndex > 0, , TAB tabIndex > 0
  • tabIndex > 0,
  • if current.tabIndex - next.tabIndex > 1 , tabIndex
  • tabIndex, ( tabIndex )
    -------------------------------------------------- -----------------------------

    :

  • TAB DisplayObjects ( , ) - tabIndex > 0 .

  • TAB - tabIndex = 0 ( DisplayObjects tabIndex == 0), TAB ). tabEnabled = false
  • DisplayObject TAB - tabIndex ( ) tabIndex, .

    , TAB , , . 10 .

( ):
showclasses.NewFile.mxml:

<mx:VBox xmlns:mx="library://ns.adobe.com/flex/mx"
         xmlns:fx="http://ns.adobe.com/mxml/2009" data="1,2,3" creationComplete="addFocuses();">
    <fx:Script>
        <![CDATA[       
        private function addFocuses():void{
            var focs:Array = data.split(',');
            One.tabIndex = focs[0];
            Two.tabIndex = focs[1];
            Three.tabIndex = focs[2];           
        }       
        ]]>
    </fx:Script>
    <mx:Label text="One"/>
    <mx:TextInput id="One" />
    <mx:Label text="Two" />
    <mx:TextInput id="Two"/>
    <mx:Label text="Three" />
    <mx:TextInput id="Three"/>
</mx:VBox>

Main.mxml:

<mx: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" 
    xmlns:th="showclasses.*">
    <mx:HBox>
        <th:NewFile data="1,2,3" />
        <th:NewFile data="1,2,3" />
        <th:NewFile data="1,2,3" />
    </mx:HBox>
</mx:Application>

1,2,3; 1,2,3; 1,2,3 - (, tabIndex ), .
2; , 3; 0, null, 1 (null == 0 tabIndex) - , , , .
,

+7

, info www0z0k (, , ?) Flex Docs tabIndex:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#tabIndex

SWF . TabIndex -1, , .

- SWF tabIndex , , tabIndex SWF . , tabIndex .

tabIndex . tabIndex . tabIndex 1 tabIndex 2. tabIndex .

, tabIndex, . , SWF. SWF tabIndex , tabIndex.

. Flex 3.3.0 β„– 1 β„– 2, www0z0k, . # 1 , tabIndex, , . β„– 2 , tabIndex, .

+1

All Articles