Function Reference


_GUICtrlListView_SetSelectionMark

Sets the selection mark in the control

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

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of the new selection mark. If -1, the selection mark is removed.

Return Value

Success: the previous selection mark.
Failure: -1 if there is no previous selection mark.

Remarks

The selection mark is the item index from which a multiple selection starts.
This message does not affect the selection state of the item.

Related

_GUICtrlListView_GetSelectionMark

Example

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

Example()

Func Example()
    Local $idListview

    GUICreate("ListView Set Selection Mark", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
    GUISetState(@SW_SHOW)

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

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

    ; Select item 1
    _GUICtrlListView_SetSelectionMark($idListview, 1)
    MsgBox($MB_SYSTEMMODAL, "Information", "Selected Mark: " & _GUICtrlListView_GetSelectionMark($idListview))

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