Function Reference


_GUICtrlListView_SetSelectedColumn

Sets the index of the selected column

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

Parameters

$hWnd Control ID/Handle to the control
$iCol Specifies the column index

Return Value

None.

Remarks

Columns are 0-based index.

Related

_GUICtrlListView_GetSelectedColumn

Example

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

Example()

Func Example()
    Local $idListview

    GUICreate("ListView Set Selected 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)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1")
    _GUICtrlListView_AddItem($idListview, "Item 2")
    _GUICtrlListView_AddItem($idListview, "Item 3")

    ; Select column 2
    _GUICtrlListView_SetSelectedColumn($idListview, 1)
    MsgBox($MB_SYSTEMMODAL, "Information", "Selected Column: " & _GUICtrlListView_GetSelectedColumn($idListview))

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