zhaicheng Posted January 25, 2011 Share Posted January 25, 2011 Is there a way to make a click select an item in the list view and keep that item selected when another item is clicked? So, what I want is to single-click items in a list to select them, without needing to hold down the Ctrl or Shift keys. Link to comment Share on other sites More sharing options...
wakillon Posted January 25, 2011 Share Posted January 25, 2011 (edited) _GUICtrlListView_GetSelectedIndices ( ) function can help you ! #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 January 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now