Sign in to follow this  
Followers 0
Kogmedia

Problem - Listbox

3 posts in this topic

#1 ·  Posted (edited)

Hello,

I am trying to delete checked items in the listview, however when I delete a item the index changed stopping it from deleting the rest of the item I have checked my code and it is finding the correct checkbox, but when it deletes one the script messes up? and will skip 1

ie. if i check 4 boxes it will delete 2

for $i = 0 to _GUICtrlListViewGetItemCount($listbox)-1
$checked = _GUICtrlListViewGetCheckedState ( $listbox, $i )
If $checked = 1 Then
_GUICtrlListViewDeleteItem ( $listbox, $i )
next
Edited by Kogmedia

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I found a work around allowed multiplesel then highlight and delete the items.

$listbox = GUICtrlCreateListView($header,0,0,1024,770,$LBS_MULTIPLESEL)
~~
For $i = 0 to _GUICtrlListViewGetItemCount($listbox)-1
$checked = _GUICtrlListViewGetCheckedState ( $listbox, $i )
If $checked = 1 Then
_GUICtrlListViewSetItemSelState ($listbox,$i,1)
EndIf
Next
_GUICtrlListViewDeleteItemsSelected ($listbox)
Edited by Kogmedia

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search

Share this post


Link to post
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
Sign in to follow this  
Followers 0