Getting user typed input from and editable ComboBox

Note: Something wonky was going on the first time I tried this and it turns out that this is very easy to do without extending the ComboBox. Lesson learned: if you really, REALLY think something should work and it doesn’t then reboot and try again.

You would think that if you make a Flex ComboBox editable then it would be easy to get the value that the user typed in, right? I mean, why else give a ComboBox a property of editable. It’s one of those things that seems so obvious that I spent an hour running through the debuger looking for the value I had typed in that I thought I must be missing something.

If I’m missing something I’d appreciate it if someone would point out to me just how you can get the value*. As it turned out it was very easy to do by extending the ComboBox and overriding the textInput_changeHandler method. As I was trying to find an obvious way to get at the data I kept thinking, “Just override the frakking ComboBox to get at the data.” I should have listened to that inner voice sooner and saved an hour of frustration.

view source

After lots of searching about the only useful post I found was this one by strikefish at UniversalMind. They’re ComboBox-lookAhead is really cool. This is where I figured out to override the textInput_changeHandler to get at the data I needed.

I’d appreciate your comments if you can think of ways to improve this approach.

*Note: guessing that if it can be done Tink will be the first to comment the solution. Don’t let me down Tink. :-)