Function Reference

_GUICtrlListViewSetHotItem

Sets the hot item for a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewSetHotItem($h_listview, $i_index)

 

Parameters

$h_listview control id/control hWnd
$i_index Zero-based index of the item to be set as the hot item

 

Return Value

Returns the index of the item that was previously hot
$LV_ERR is returned if no item previously hot

 

Remarks

None.

 

Related

_GUICtrlListViewGetHotItem, _GUICtrlListViewGetHoverTime, _GUICtrlListViewSetHoverTime

 

Example


#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_set
GUICreate("ListView Set Hot Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_set = GUICtrlCreateButton("Set index 2", 75, 260, 70, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 200, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_set
            _GUICtrlListViewSetHotItem($listview,2)
            GUICtrlSetData($Status, "Hot Item: " & _GUICtrlListViewGetHotItem ($listview))
    EndSelect
WEnd
Exit