我正在使用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>
答案 0 :(得分:0)
在Flex列表中,Itemrenderer可能无法获得焦点,因为它不可编辑且不会实现焦点管理器界面,您需要在项目渲染器 components.InputParamIR 中实现IFocusManagerComponent,您还必须覆盖您的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
}
}
}
了解这些
Tile list item renderer text focus solved
Issues with keyboard navigation on list with custom renderer
我希望这会对你有所帮助
快乐的编码......