# Function Reference

# _GUICtrlListView_SetColumnWidth

Changes the width of a column

#include <GuiListView.au3>
_GUICtrlListView_SetColumnWidth ( $hWnd, $iCol, $iWidth )

## Parameters

$hWnd | Control ID/Handle to the control
$iCol | 0-based index of a valid column.
$iWidth | New width of the column, in pixels. For report-view mode, the following special values are supported: $LVSCW_AUTOSIZE - Automatically sizes the column. $LVSCW_AUTOSIZE_USEHEADER - Automatically sizes the column to fit the header text. If you use this value with the last column, its width is set to fill the remaining width of the list-view control.

## Return Value

Success: | True.
Failure: | False.

## Remarks

If the ListView is in "List" mode then the $iCol parameter must be set to zero as there can only be a single column. Note that the normal mode for a ListView is "Report" - all other modes display icons.

## Related

_GUICtrlListView_GetColumnWidth, _GUICtrlListView_HideColumn

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        GUICreate("ListView Get/Set Column Width (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("Column 0|Column 1|Column 2", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        _GUICtrlListView_SetColumnWidth($idListview, 0, 100)

        ; Change column 0 width
        MsgBox($MB_SYSTEMMODAL, "Information", "Column 0 Width: " & _GUICtrlListView_GetColumnWidth($idListview, 0))
        _GUICtrlListView_SetColumnWidth($idListview, 0, 150)
        MsgBox($MB_SYSTEMMODAL, "Information", "Column 0 Width: " & _GUICtrlListView_GetColumnWidth($idListview, 0))

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