Function Reference


Changes the width of a column

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


$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.


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.


_GUICtrlListView_GetColumnWidth, _GUICtrlListView_HideColumn


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


Func Example()
    Local $idListview

    GUICreate("ListView Set Column Width", 400, 300)
    $idListview = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)

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

    ; Loop until the user exits.
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>Example