Supported PlatformsProject Types: Desktop Platforms: OS X, Windows, Linux
OS X Cocoa limits ComboBox height to just a single size. Any changes to the Height property are ignored.
On Cocoa, the maximum number of visible rows in the dropdown is 15. You can adjust this number using this declare, passing in the ComboBox's handle for controlHandle:
This code in the Open event handler populates a ComboBox and sets the initial value to the current month:
Dim i, last As Integer
Dim d As New Date
s = "January,February,March,April,May,June,July," _
last = CountFields(s,",")
For i = 1 To last
Me.AddRow(NthField(s, ",", i))
Me.ListIndex = d.Month-1
The value of the ListIndex property contains the index of the selected item, but it does not indicate whether the user has entered text into the ComboBox. Examine the Text property to get the current menu selection or the text entered by the user. For example, the following line in the TextChanged event handler displays either the currently selected menu item or the text typed into the ComboBox.
This example adds an item to a ComboBox in its Open event handler.
This example opens a new window when an item is chosen.
Dim w As ListEditorWindow
If ComboBox1.Text = "Edit List..." Then
w = New ListEditorWindow
The following line changes the selected item in a ComboBox