rootx Posted June 30, 2017 Share Posted June 30, 2017 (edited) I need help to fix this Func deletesel($totsel) $count = 0 For $x = 0 To $totsel If _GUICtrlListView_GetItemChecked($listview, $x) Then $totsel2 = _GUICtrlListView_GetItemText($ListView,$x, 6) _GUICtrlListView_DeleteItem($ListView,$x) _GUICtrlListView_SetItemChecked($listview,$x,False) $count += 1 ConsoleWrite($totsel&" - "&$x&" "&$totsel2&@CRLF) EndIf Next $TOT2 = _GUICtrlListView_GetItemCount($ListView) ConsoleWrite($TOT2&" "&$count) Return $count EndFunc 1. the first row have index = 0 .... if you try to count it fails... EX 10-0=10, Obviously if you select more elements from the second row, the result is correct. 2. I have added _GUICtrlListView_SetItemChecked($listview,$x,False) because at the end of the loop the first elements result checked. Edited June 30, 2017 by rootx Link to comment Share on other sites More sharing options...
benners Posted June 30, 2017 Share Posted June 30, 2017 Just a guess but if you are deleting the listview items, I would think you'd have to work backwards to delete them to keep the indexes the same. If you delete the item where x = 1 for example then when you set the item as checked it will be a different item at index one. 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