|
-
December 14th, 1999, 10:03 AM
#1
Combobox, showing entire list at all times
A combobox, type 2-Dropdown-list, automatically invokes a vertical scrollbar when the number of listitems exceeds 8. Is there a way to prohibit this behaviour forcing it to show the entire list or a number of my choice?
Regards
Patrik
-
December 14th, 1999, 02:39 PM
#2
Re: Combobox, showing entire list at all times
You can increase the size of the Drop Down List using the SetWindowPos API, eg.
private Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
private Declare Function GetWindowRect Lib "user32" (byval hwnd as Long, lpRect as RECT) as Long
private Declare Function SetWindowPos Lib "user32" (byval hwnd as Long, byval hWndInsertAfter as Long, byval x as Long, byval y as Long, byval cx as Long, byval cy as Long, byval wFlags as Long) as Long
private Const SWP_FRAMECHANGED = &H20
private Const SWP_NOMOVE = &H2
private Const SWP_NOZORDER = &H4
private Sub SetComboDropSize(byval lHwnd as Long, byval lHeight as Long)
Dim tRECT as RECT
Call GetWindowRect(lHwnd, tRECT)
SetWindowPos lHwnd, 0, 0, 0, tRECT.Right - tRECT.Left, lHeight, SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Sub
private Sub Form_Load()
'set Drop Height to display 16 Items..
Call SetComboDropSize(Combo1.hwnd, 240)
for i = 1 to 16
Combo1.AddItem "Item" & i
next
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
December 15th, 1999, 03:59 AM
#3
Re: Combobox, showing entire list at all times
Bullseye!
Thanks a lot Aaron. May Santa reward you generously.
Regards
Patrik Fällman, Luleå, Sweden
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|