简体   繁体   中英

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? 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?

The dropDown is a component of type ListBase, and can be accessed through the dropDown property. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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