Loading...
 
[Show/Hide Right Column]

Development

Combo Breaker

Some things about Flex just seize my heart and fill me with despair.

The ComboBox control, for example. To do it right, you connect the combo box to a dataprovider, basically an array of some kind. Then you tell it what field of the data to show in the display. If there's nothing selected then it just shows a blank. That's great.

But when you need to select nothing in the combo box, that's when your life of misery begins. See, it's all well and good to start with selectedItem == null, but there's no way for the user to set selectedItem = null. You can do it programmatically, though, so you could add a button to your GUI just for the purpose of deselecting items in the combobox. I think Jef Raskin descends from the heavens to award you 10,000 IEEE style points for doing this. It's brilliant.

You know, I've actually seen people solve the problem that way. But that's insane. You have a control that starts in a certain state, and no way to get back to it. But it's a valid state! And it might be, I don't know, ABSOLUTELY CRUCIAL in order for your (read: my) application to work.

I got the solution(external link) (?) from adobe. You need to create a new dataprovider (ArrayCollection) that adds a selection for nothing selected. Then you detect your dummy item and set your null manually. This is a total hack. Especially considering the user cannot select all the valid states of the control without it. You'll notice the solution is from Flex 2. So they knew about it for a while and have decided not to fix it, and likely will not fix it. Absurd.

All told, I spent several hours of my life trying to work around this ridiculousness. Why.