Jump to content
Sign in to follow this  

horizontal scroll on combo

Recommended Posts


i got the vertical scroll to work but cant seem to get the horizontal scroll

there might be a requirement before getting the Hscroll to work.. thought it might be the border.. but cant find the requirement in help file.

Edited by gcue

Share this post

Link to post
Share on other sites

#include <GUIComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)


Func Example()
    Local $msg, $sItems, $tSize
    Local $hGUI, $hDC

    $hGUI = GUICreate("My GUI combo")  ; will create a dialog box that when displayed is centered

    GUICtrlCreateCombo("Itemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm1", 10, 10, 160, 23, _
        BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $WS_HSCROLL)) ; create first item

    For $i = 2 To 100
        $sItems &= "|Itemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm" & $i

    GUICtrlSetData(-1, StringTrimLeft($sItems, 1)) ; add other items

    $hDC = _WinAPI_GetDC($hGUI)
    $tSize = _WinAPI_GetTextExtentPoint32($hDC, "Itemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm100")
    _WinAPI_ReleaseDC($hGUI, $hDC)

    ; Set to biggest string length in pixel minus the control width
    GUICtrlSendMsg(-1, $CB_SETHORIZONTALEXTENT, DllStructGetData($tSize, "x")-160, 0)

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
EndFunc   ;==>Example

Share this post

Link to post
Share on other sites

wow thats complex!

thanks for your help Authenticity

Share this post

Link to post
Share on other sites

Maybe send it a window message to set CB_SETHORIZONTALEXTENT, and ensure the CBS_DISABLENOSCROLL style is cleared.


Edit: Authenticity whooped it already. Doh! :blink:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.