Function Reference


_GUICtrlListView_SetColumn

Sets the attributes of a column

#include <GuiListView.au3>
_GUICtrlListView_SetColumn ( $hWnd, $iIndex, $sText [, $iWidth = -1 [, $iAlign = -1 [, $iImage = -1 [, $bOnRight = False]]]] )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of new column
$sText Column header text
$iWidth [optional] Width of the column, in pixels
$iAlign [optional] Alignment of the column header and the subitem text in the column:
    0 - Text is left aligned
    1 - Text is right aligned
    2 - Text is centered
$iImage [optional] 0-based index of an image within the image list
$bOnRight [optional] If True, the column image appears to the right of text

Return Value

Success: True.
Failure: False.

Related

_GUICtrlListView_GetColumn, _GUICtrlListView_JustifyColumn

Example

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

Example()

Func Example()
    Local $aInfo, $idListview

    GUICreate("ListView Set Column", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

    ; Change column
    $aInfo = _GUICtrlListView_GetColumn($idListview, 0)
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & $aInfo[4])
    _GUICtrlListView_SetColumn($idListview, 0, "New Column 1", 150, 1)
    $aInfo = _GUICtrlListView_GetColumn($idListview, 0)
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & $aInfo[4])

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