将焦点设置在内部有 TextArea 的列表 ItemRenderer 上?
我为 List 组件 (Flex 3.5) 编写了一个自定义 itemrenderer,该组件是一个包含 Label 和 TextArea 的 VBox。到目前为止一切正常,但我希望第一个项目渲染器中的 TextArea 接收焦点,以便在点击列表时它立即变得可编辑。这可能吗?如果我将如何实现这一目标?
我已经添加了一个事件侦听器,用于选择索引 0 处的项目,但其中的 textArea 也应该在此时聚焦......
_list.addEventListener(FocusEvent.FOCUS_IN, onListFocusIn);
private function onListFocusIn(e:FocusEvent):void
{
_list.selectedIndex = 0;
}
I've wrote a custom itemrenderer for a List component (Flex 3.5) which is a VBox with a Label and a TextArea wrapped inside. All works fine so far but I want the TextArea in the first itemrenderer to receive focus so that it instantly becomes editable when tabbing onto the List. Is that possible and if how would I achieve this?
I've already added an event listener that selects the item at index 0 but the textArea in it should also be focussed at that moment ...
_list.addEventListener(FocusEvent.FOCUS_IN, onListFocusIn);
private function onListFocusIn(e:FocusEvent):void
{
_list.selectedIndex = 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有太多的活动。一种黑客方法是覆盖 itemRenderer 的 updateDisplayList
更多详细信息
http://butterfliesandbugs。 wordpress.com/2007/06/25/how-to-know-when-my-itemrenderer-is-selected/
和
http://cookbooks.adobe.com/post_How_to_know_when_an_ItemRenderer_is_selected-5322.html
There isn't much of an event for that. One hackery way to do it is to override updateDisplayList for your itemRenderer
More details on
http://butterfliesandbugs.wordpress.com/2007/06/25/how-to-know-when-my-itemrenderer-is-selected/
And
http://cookbooks.adobe.com/post_How_to_know_when_an_ItemRenderer_is_selected-5322.html