ScrollPosition for Combobox lists?

When I click to open a combobox list, then I would like to have the listitem selected which corresponds to the entry in the textfield, plus it should scroll into view.

I found a contribution by Michel, here on this forum, which helps me to work around the Xojo bug which deselects the current list item.

But I do not see a way how I could scroll the list into view.
Does anyone have an idea? Declares?

Never mind, this MBS solution seems to work:

[code]Sub ListTimerAction(myTimer As Timer)
'******************************************************************
’ Purpose: work around deselection bug of Xojo ComboBox
’ (when opening the list) and reselect the item which corresponds
’ to the entry in the textfield of the combo.
'******************************************************************

For i As Integer = 0 To Me.listCount-1
If Me.Text = Me.List(i) Then
Me.listIndex=i
#If TargetCocoa
Me.NSComboBoxMBS.scrollItemAtIndexToVisible(i)
#Endif

  Exit
End If

Next
End Sub
[/code]

1 Like