Jump to content

Hiding listview items that do not match criteria


Recommended Posts

Here is my code:

$isChecked = IniRead(@ScriptDir & "\temp.ini", "Options", "ShowOn", "Unable to read file.")
    If $isChecked = "1" Then; is user wants to only show specific data
        $bud = IniReadSection(@ScriptDir & "\temp.ini", "Active")
        If IsArray($bud) Then
        For $r = 1 To $bud[0][0]
            $f_trimmed = StringTrimRight($bud[$r][1], 1)
            $trimmed = StringRight($f_trimmed, 2)
            If $trimmed = "On" Then; make sure we extracted the right data
                $v_var = _GUICtrlListView_GetItemText($nListview, $r, 1)
                If $v_var = $bud[$r][0] Then; text from the ini matches then dont do anything
            ; do nothing
                Else
                    _GUICtrlListView_DeleteItem($nListview, $r)
                EndIf
            EndIf
        Next
    Else
        EndIf
    Else
    EndIf

Basically what I had in mind when writing this was for it to read an ini file and a specific section and put that into an array.

Then it would it would use criteria set to filter out all the data that didn't match the criteria and delete those items from the listview.

Well it's deleting all of the listview items that don't match the criteria (and it's supposed to up to this point).

But THEN, it deletes the items that it isn't supposed and I think because the count is wrong or something

I'm brainfrozen right now and can't think of a better way to explain it.

For whoever knows somewhat of what I'm attempting to do can you help me out on finding a way to delete all the listview items that don't match the criteria based on their ini content. Like delete the items that aren't in a particular section, like the [Active] section for example.

Please help. :)

Edited by nowagain
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...