Desktop Combo Box
From Xojo Documentation
The Combo Box control works like a combination of a Text Field and a Popup Menu. The user can either enter text in the Combo Box or choose an item from the attached Popup Menu. A menu selection can be modified after it is selected. Unlike a real Text Field, you cannot use a mask to filter data entry or operate it as a Password Field.
Refer to ComboBox in Reference Guide for details on all its events, properties and methods.
Below is a list of common events, properties and methods.
- Called when the selected item in the popup menu has changed.
- Called when the text was changed, either by typing or through code (by setting the Text property).
- This property takes one parameter, an index of the row. It returns the text of the item in the menu specified by the index parameter. If the index does not exist, then an OutOfBoundsException is raised.
ListCount As Integer
- An Integer containing the number of rows in the menu.
ListIndex As Integer
- An Integer used to get or set the currently selected row in the menu.
Text As String
- Contains the text of the currently selected row.
- Takes as a parameter a string or an array of strings to add a row or rows to the menu.
- Adds a separator line (only on Mac).
- Removes all rows from the menu.
- Takes as parameters the row and name of item to insert into the menu.
- Takes as parameters the number of the row to remove.
- Takes as a parameter the number of the row to which to assign the tag. The tag can be any value or class (variant).
ComboBoxes on any platform display the focus by highlighting the selected item and showing a blinking insertion point. On Mac, a ComboBox with the focus also has a focus ring. When a ComboBox has the focus, you can scroll through the list of choices with the up and down arrow keys and select an item by pressing the Return key. Of course, you can also edit or replace the selected item.
You can use an array to populate the ComboBox: