选项卡在mx:TileList组件中不起作用



我使用mx:Tilelist组件在屏幕上显示一组文本字段,但是当我尝试通过TAB键遍历字段时,焦点移出列表。请提供这个问题的解决方案下面是我使用的代码

    <mx:TileList id="tileList"
            dataProvider="{collection}"
            change="setCurrentIndex(tileList.selectedIndex);"
            dataChange="setCurrentIndex(tileList.selectedIndex);"
            columnCount="1"
            columnWidth="345"
            itemRenderer="components.InputParamIR"
            rowHeight="30"
            verticalScrollPolicy="auto"
            horizontalScrollPolicy="auto"
            backgroundColor="#EEEEEE"
            dragEnabled="false"
            dragMoveEnabled="true"
            dropEnabled="true"
            width="100%" height="100%"
            itemClick="chartTileClick(event);" 
            />

<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;
        import mx.containers.Panel;
        [Bindable]
        public var index:uint;
        [Bindable]
        public var collection:ArrayCollection = new ArrayCollection(); 
        [Bindable]
        public var isVisible:Boolean ;
        public  function initEventsLocal(event:Event):void
            {
             this.initEvents(event);
             collection = new ArrayCollection(); 
             isVisible = false;
            }   
        private function chartTileClick(event:ListEvent):void
        {
            event.currentTarget.tabFocusEnabled=true;
            event.currentTarget.tabEnabled=true;
        } 
    ]]>
</fx:Script>

在Flex列表Itemrenderer可能不会得到焦点,因为它是不可编辑的,它不会实现焦点管理器接口,你需要在你的项目渲染器组件中实现IFocusManagerComponent。InputParamIR你还必须重写你的TileList类来启用儿童标签。

package  
{  
    import mx.controls.TileList;  
        public class MyTileList extends TileList  
        {  
            override protected function createChildren():void {  
              super.createChildren();  
              this.listContent.tabChildren = this.tabChildren  
              this.listContent.tabEnabled = this.tabEnabled  
            }  
        }  
}    

看看这些

平铺列表项渲染器文本焦点解决

带有自定义渲染器的列表中键盘导航的问题

我希望这对你有帮助

快乐编码…

最新更新