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.
Events
- Called when the selected item in the popup menu has changed.
- Called when the value was changed, either by typing or through code (by setting the Value property).
Properties
- 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.
RowCount As Integer
- An Integer containing the number of rows in the menu.
SelectedRowIndex As Integer
- An Integer used to get or set the currently selected row in the menu.
SelectedRowValue As String
- Contains the text of the currently selected row.
Methods
- 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.
- Adds a row at the index position and using the text passed.
- 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).
Handling Focus
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.
Usage
You can use an array to populate the ComboBox:
See Also
ComboBox class; UserGuide:Desktop Popup Menu topic