Does anyone know how to open/close (show/hide) the list of a Combobox?
I’m trying to make an x-plat Searchbox with suggestions. Based on what the user typed, the suggestions change.
I currently have a Textfield & Listbox but I’m trying to replace it with a Combobox.
To show the Combobox list, I now have to either click the arrow or key down.
I’m trying to make it so that the list is always expanded if there is something to suggest (when I’ve added rows to the Combobox). And close/hide it when the list is empty.
If you want expand automatically the combobox, perhaps you can use this code in combobox GotFocus event:
Soft Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal hwnd As Integer, ByVal wMsg As UInt32, ByVal wParam As Integer, param1 As Integer) As Integer
Const CB_SHOWDROPDOWN = &H14F
Const ShowDropDown = 1
Const HideDropDown = 0
Call SendMessage(Me.Handle, CB_SHOWDROPDOWN, ShowDropDown, 0)
This idea was provided by Paul Lefebvre with this thread some years ago:
Thank you Elvis.
Not so good news though because instead of declares, I’d hoped there was something already build in so I could also use it on Linux and OSX as well.