Function Reference


_GUICtrlListView_GetColumn

Retrieves the attributes of a column

#include <GuiListView.au3>
_GUICtrlListView_GetColumn ( $hWnd, $iIndex )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of column

Return Value


Returns an array with the following format:
    [0] - 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
    [1] - True if item displays an image from an image list
    [2] - True if bitmap appears to the right of text
    [3] - True header contains an image
    [4] - Width of the column, in pixels
    [5] - Column header text
    [6] - Index of subitem associated with the column
    [7] - 0-based index of an image within the image list
    [8] - 0-based column order

Related

_GUICtrlListView_JustifyColumn, _GUICtrlListView_SetColumn

Example

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

Example()

Func Example()
        GUICreate("ListView Get Column (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("col0|col1|col2", 2, 2, 394, 268)
        _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
        _GUICtrlListView_SetColumnWidth($idListview, 0, 100)
        GUISetState(@SW_SHOW)

        ; Set ANSI format
;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

        GUICtrlCreateListViewItem("index 0|data0|more0", $idListview)
        GUICtrlCreateListViewItem("index 1|data1|more1", $idListview)
        GUICtrlCreateListViewItem("index 2|data2|more2", $idListview)
        GUICtrlCreateListViewItem("index 3|data3|more3", $idListview)
        GUICtrlCreateListViewItem("index 4|data4|more4", $idListview)

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

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

        GUIDelete()
EndFunc   ;==>Example