# Function Reference

# _GUICtrlListBox_SetHorizontalExtent

Set the width, in pixels, by which a list box can be scrolled horizontally

#include <GuiListBox.au3>
_GUICtrlListBox_SetHorizontalExtent ( $hWnd, $iWidth )

## Parameters

$hWnd | Control ID/Handle to the control
$iWidth | Specifies the number of pixels the list box can be scrolled

## Return Value

None.

## Remarks

To respond to the _GUICtrlListBox_SetHorizontalExtent(), the list box must have been defined with the $WS_HSCROLL style.

## Related

_GUICtrlListBox_GetHorizontalExtent

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiListBox.au3>
    #include <MsgBoxConstants.au3>
    #include <WindowsStylesConstants.au3>

    Example()

    Func Example()
        Local $idListBox

        ; Create GUI
        GUICreate("List Box Get/Set Horizontal Extent (v" & @AutoItVersion & ")", 400, 296)
        $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
        GUISetState(@SW_SHOW)

        ; Add long string
        _GUICtrlListBox_AddString($idListBox, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.")

        ; Show current horizontal extent
        MsgBox($MB_SYSTEMMODAL, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($idListBox))

        _GUICtrlListBox_SetHorizontalExtent($idListBox, 500)

        ; Show current horizontal extent
        MsgBox($MB_SYSTEMMODAL, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($idListBox))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example