Jump to content

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.

BitOR($CBS_DROPDOWNLIST, $WS_BORDER, $WS_HSCROLL, $WS_VSCROLL)
Edited by gcue
Link to comment
Share on other sites

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

Opt('MustDeclareVars', 1)

Example()

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
    Next

    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)
    GUISetState()

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

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

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...