Darien Posted July 28, 2023 Posted July 28, 2023 Hello, When I open a drop-down box, a maximum of 30 items are displayed on the screen at once (and there is space on the screen to display more). To show more items, I have to go down with the arrow. Is there any way to show more than 30 items or to display a scroll bar on the right?
Moderators Solution Melba23 Posted July 28, 2023 Moderators Solution Posted July 28, 2023 Darien, I get a scroll bar displayed as soon as I go over 30 items: #include <GUIConstantsEx.au3> GUICreate("Test", 300, 100) $Combo = GUICtrlCreateCombo("", 10, 30, 280, 25) For $i = 1 To 31 GUICtrlSetData($Combo, "Combo Item Number: " & $i) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Combo ConsoleWrite(GUICtrlRead($Combo) & @CRLF) EndSwitch WEnd And you change the number of displayed items like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> ; Create 25 data items $sData = "|" For $i = 1 To 45 $sData &= $i & "|" Next $hGUI = GUICreate("Test", 500, 500) ; Create the combo with a read-only edit field and a scrollbar $hCombo = GUICtrlCreateCombo("", 10, 10, 100, 20, BitOr($CBS_DROPDOWNLIST, $WS_VSCROLL)) ; Set number of visible items GUICtrlSendMsg($hCombo, $CB_SETMINVISIBLE, 40, 0) GUICtrlSetData($hCombo, $sData) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Hope that helps, M23 Musashi and Skysnake 2 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Darien Posted July 28, 2023 Author Posted July 28, 2023 Thanks. For me the scrollbar only appeared when I used the $WS_VSCROLL parameter (which is not in the AutoIt help).
Musashi Posted July 28, 2023 Posted July 28, 2023 1 hour ago, Darien said: For me the scrollbar only appeared when I used the $WS_VSCROLL parameter (which is not in the AutoIt help). It's in the help , see : https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateCombo.htm GUICtrlCreateCombo ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] ) Parameters text The text which will appear in the combo control. left The left side of the control. If -1 is used then left will be computed according to GUICoordMode. top The top of the control. If -1 is used then top will be computed according to GUICoordMode. width [optional] The width of the control (default is the previously used width). height [optional] The height of the control (default is the previously used height). style [optional] Defines the style of the control. See GUI Control Styles Appendix. default (-1) : $CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL forced style : $WS_TABSTOP exStyle [optional] Defines the extended style of the control. See Extended Style Table. default ( -1) : $WS_EX_CLIENTEDGE "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now