Home > Flex > Triggering the Selection Highlight Around ComboBox

Triggering the Selection Highlight Around ComboBox

Today, I ran into an interesting little gotcha.  When programatically setting the focus to a ComboBox I was surprised to learn that the component does not automatically show the highlight around the ComboBox.  Apparently, it only does this automatically for TextInput and TextArea components.  I found this buried in the Language Reference under the UIComponent class under the setFocus() method.

Note: Only the TextInput and TextArea controls show a highlight when this method sets the focus. All controls show a highlight when the user tabs to the control.

To get the ComboBox to highlight requires an additional line of code.  For example:

focusManager.setFocus(MyComboBox);
focusManager.showFocus();     //not needed if using TextArea or TextInput

These types of idiosyncrasies in the Flex framework can really be annoying!  Why isn’t behavior consistent among all the components?


Categories: Flex Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.