Jump to content
Sign in to follow this  
Jewtus

Deleting all occurrences in list view

Recommended Posts

Jewtus

I have a listview in one of my GUIs and I have a button and box for filtering the results.
 

This is the function I'm using right now:

$Index=_GUICtrlListView_FindInText($List,GUICtrlRead($FilterInput))
                MsgBox(0,"test",$Index)
                _GUICtrlListView_DeleteItem($List,$Index)

I've tried using the $bWrapOK command in the find, but I don't really understand how it works.

Basically, what I'm trying to do is find every occurrence of the input filter and delete anything that DOESN'T contain that value.

Tips/Suggestions?

Share this post


Link to post
Share on other sites
mikell

Suggestion, loop through the items with _GUICtrlListView_GetItemText, compare each result with the filter using StringInStr or regex, then delete the item if doesn't match

Share this post


Link to post
Share on other sites
Jewtus

Perfect! Thats what I needed.

For anyone who wants the code:

Case $Clean
For $j=UBound($array) -1 to 0 Step -1
$Cleanval=_GUICtrlListView_GetItemText($List,$j,2)
If StringInStr($Cleanval,GUICtrlRead($FilterInput))=0 Then _GUICtrlListView_DeleteItem($List,$j)
Next

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  

×