Flex 组合框中的 ItemClick 事件 [英] ItemClick Event in a flex Combobox

查看:26
本文介绍了Flex 组合框中的 ItemClick 事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道,有没有办法在 Flex ComboBox(或任何类似的东西)中捕获 ItemClick 事件.也许有什么技巧.. :) 我确实意识到,我可以自定义它,但这不适合我的情况.

Does anyone know, is there any way to catch ItemClick Event in a Flex ComboBox (or anything similar). Maybe there's any trick .. :) I do realize, that I can customize it, but this not suits my case.

感谢您的时间:)

推荐答案

正如您在 mx:ComboBox 来源中所见,创建下拉列表的函数是私有的,ITEM_CLICK 是私有的,列表本身也是私有的:

As you can see in mx:ComboBox sources, the function, creating the dropdown list, is private, the listener to ITEM_CLICK is private and the list itself is also private:

private var _dropdown:ListBase;

private function getDropdown():ListBase
{
        // ...

        _dropdown = dropdownFactory.newInstance();

        // ...

        _dropdown.addEventListener(ListEvent.ITEM_CLICK, dropdown_itemClickHandler);

        // ....
}

private function dropdown_itemClickHandler(event:ListEvent):void
{
    if (_showingDropdown)
    {
        close();
    }
}

所以你甚至不能扩展ComboBox.

唯一公开的是dropdownFactory,理论上可以覆盖它以注册创建的下拉列表或创建扩展列表.但我看到的问题是 ComboBox 不是下拉列表的父级 - PopupManager 是.这会使调度(冒泡)事件变得非常困难.

The only public thing is dropdownFactory, which theoretically can be overriden to somehow register the created dropdown list or create extended list. But the problem I see is that ComboBox is not the parent of dropdown list - PopupManager is. This can make dispatching (bubble) events quite difficult.

这篇关于Flex 组合框中的 ItemClick 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆