简体   繁体   English

Flex:有没有办法找到ComboBox打开的时候?

[英]Flex: Is there any way to find find out when a ComboBox is open?

I may be missing something here because I thought this might be really easy but... 我可能在这里遗漏了一些东西,因为我认为这可能很容易,但......

Using Flex, how can you tell when a ComboBox is open? 使用Flex,如何判断ComboBox何时打开? I do find the open and close events that this component dispatches can be flaky so I'm looking for something a little more solid - it's probably staring me in the face. 我确实发现这个组件发送的开放和关闭事件可能是片状的,所以我正在寻找一些更加坚固的东西 - 它可能正盯着我看。

How about checking either the existence or the visibility of the dropDown component? 如何检查dropDown组件的存在或可见性?

The dropDown is a component of type ListBase, and can be accessed through the dropDown property. dropDown是ListBase类型的组件,可以通过dropDown属性访问。 So maybe something like this (I didn't have time to test this myself): 也许这样的事情(我没有时间自己测试):

if (myComboBox.dropDown != null && myComboBox.dropDown.visible) {
    // myComboBox is open
}

The myComboBox.dropDown != null is a safety check so you will not get runtime errors trying to access the visible property of a null object. myComboBox.dropDown != null是一个安全检查,因此您不会在尝试访问null对象的visible属性时遇到运行时错误。

The designers probably thought it was enough with the open and close events. 设计师可能认为开放和近距离事件已经足够了。

EDIT: I'll clarify that. 编辑:我会澄清一下。 Looking for a property that would reveal the opened/closed status of the combobox I fail to find it. 寻找一个可以揭示组合框打开/关闭状态的属性我找不到它。 And to my experience there's nothing flaky about the event system. 根据我的经验,事件系统并没有什么特别之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM