Jump to content

select an item in the list view in a sticky way


Recommended Posts

_GUICtrlListView_GetSelectedIndices ( ) function can help you ! Posted Image

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Global $hListView, $_Selection, $_SelectionOld
    
GUICreate("ListView Get Selected Indices", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddItem($hListView, "Item 0")
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_SetItemSelected($hListView, 1)
_GUICtrlListView_SetItemSelected($hListView, 2)
    
Do
    $_Selection = _GUICtrlListView_GetSelectedIndices($hListView)
    If $_Selection <> '' And $_Selection <> $_SelectionOld Then
        MsgBox(4160, "Information", "Selected Indices: " & _GUICtrlListView_GetSelectedIndices($hListView))
        $_SelectionOld = $_Selection
    EndIf 
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...