Function Reference


_GUICtrlListView_InsertColumn

Inserts a new column in the control

#include <GuiListView.au3>
_GUICtrlListView_InsertColumn ( $hWnd, $iIndex, $sText [, $iWidth = 50 [, $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: the index of the new column.
Failure: -1.

Remarks

The alignment of the leftmost column is always left-justified; it cannot be changed.

Related

_GUICtrlListView_DeleteColumn

Example

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

Example()

Func Example()
    Local $idListview

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

    ; Insert columns
    _GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100)
    _GUICtrlListView_InsertColumn($idListview, 1, "Column 2", 100)
    _GUICtrlListView_InsertColumn($idListview, 2, "Column 3", 100)

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