Paul Mignard
Paul Mignard

Reputation: 5934

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.

Upvotes: 4

Views: 2278

Answers (2)

Niko Nyman
Niko Nyman

Reputation: 1926

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.

Upvotes: 4

PEZ
PEZ

Reputation: 17004

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.

Upvotes: 0

Related Questions