From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
New in 2021r3
On macOs, the ComboBox height is limited to just a single size, so any changes to the Height property are ignored.
Additionally, 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:
On Windows, the ComboBox height is controlled by the font size, so any changes you make to the Height property are ignored.
This code in the Opening event handler populates a DesktopComboBox and sets the initial value to the current month:
Var last As Integer
s = "January,February,March,April,May,June,July," _
last = CountFields(s, ",")
For i As Integer = 1 To last
Me.AddRow(NthField(s, ",", i))
Var d As DateTime = DateTime.Now
Var interval As New DateInterval(0, 1, 0)
d = d - interval
Me.ListIndex = d
The value of the SelectedRowIndex property contains the index of the selected item, but it does not indicate whether the user has entered a value into the DesktopComboBox. Examine the Value property to get the current menu selection or the value entered by the user. For example, the following line in the TextChanged event handler displays either the currently selected menu item or the value typed into the ComboBox.
This code adds an item to a DesktopComboBox in its Opening event handler.
This code opens a new window when an item is chosen.
Var w As ListEditorWindow
If ComboBox1.Text = "Edit List..." Then
w = New ListEditorWindow
The following code changes the selected item in a DesktopComboBox