![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
A combo box can be static or editable. A static combo box allows a user to make a single selection from a drop-down list. An editable combo box allows a user to enter text directly into a text field at the top of the list, as well as selecting an item from a drop-down list. If the drop-down list hits the bottom of the document, it opens up instead of down. The combo box is composed of three subcomponents: a Button component, a TextInput component, and a List component.
When a selection is made in the list, the label of the selection is copied to the text field at the top of the combo box. It doesn't matter if the selection is made with the mouse or the keyboard.
A ComboBox component receives focus if you click the text box or the button. When a ComboBox component has focus and is editable, all keystrokes go to the text box and are handled according to the rules of the TextInput component (see TextInput component), with the exception of the following keys:
Key |
Description |
---|---|
Control+Down |
Opens the drop-down list and gives it focus. |
Shift +Tab |
Moves focus to the previous object. |
Tab |
Moves focus to the next object. |
When a ComboBox component has focus and is static, alphanumeric keystrokes move the selection up and down the drop-down list to the next item with the same first character. You can also use the following keys to control a static combo box:
Key |
Description |
---|---|
Control+Down |
Opens the drop-down list and gives it focus. |
Control+Up |
Closes the drop-down list, if open. |
Down |
Selection moves down one item. |
End |
Selection moves to the bottom of the list. |
Escape |
Closes the drop-down list and returns focus to the combo box. |
Enter |
Closes the drop-down list and returns focus to the combo box. |
Home |
Selection moves to the top of the list. |
Page Down |
Selection moves down one page. |
Page Up |
Selection moves up one page. |
Shift +Tab |
Moves focus to the previous object. |
Tab |
Moves focus to the next object. |
When the drop-down list of a combo box has focus, alphanumeric keystrokes move the selection up and down the drop-down list to the next item with the same first character. You can also use the following keys to control a drop-down list:
Key |
Description |
---|---|
Control+Up |
If the drop-down list is open, focus returns to the text box and the drop-down list closes. |
Down |
Selection moves down one item. |
End |
The insertion point moves to the end of the text box. |
Enter |
If the drop-down list is open, focus returns to the text box and the drop-down list closes. |
Escape |
If the drop-down list is open, focus returns to the text box and the drop-down list closes. |
Home |
The insertion point moves to the beginning of the text box. |
Page Down |
Selection moves down one page. |
Page Up |
Selection moves up one page. |
Tab |
Moves focus to the next object. |
Shift-End |
Selects the text from the insertion point to the End position. |
Shift-Home |
Selects the text from the insertion point to the Home position. |
Shift-Tab |
Moves focus to the previous object. |
Up |
Selection moves up one item. |
Note: The page size used by the Page Up and Page Down keys is one less than the number of items that fit in the display. For example, paging down through a ten-line drop-down list will show items 0-9, 9-18, 18-27, and so on, with one item overlapping per page.
For more information about controlling focus, see Creating custom focus navigation or FocusManager class.
A live preview of each ComboBox component instance on the Stage reflects changes made to parameters in the Property inspector or Component Inspector panel while authoring. However, the drop-down list does not open in the live preview and the first item displays as the selected item.
When you add the ComboBox component to an application, you can use the Accessibility panel to make it accessible to screen readers. First, you must add the following line of code to enable accessibility:
mx.accessibility.ComboBoxAccImpl.enableAccessibility();
You only enable accessibility for a component once no matter how many instances you have of the component. For more information, see Creating Accessible Content.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |