Sign in to follow this  
Followers 0
chssoccer

ControlListView()

10 posts in this topic

How do I use ControlListView() to accomplish this.

I'm trying to make a filter where it searches my listview column for items containing the text "Pot Limit"

Any of the items that don't contain this text I want it to hide but I'm having trouble achieving this. How can I do this

with ControlListView()

Here's what I have but it's not working:

$zItems = ControlListView("Buddy List - v1.0", "", 89, "FindItem", "Pot Limit")
    $zcount = _GUICtrlListViewGetItemCount($sListview); counts the items in my au3 listview
    $zcount = $zcount - 1
    For $t = 0 To $zcount
        ControlHide("Buddy List - v1.0", "", $t)
        Next

Share this post


Link to post
Share on other sites

Hello! Try this:

#include <GuiListView.au3>

$title = "RegCleaner 4.3 by Jouni Vuorio"
$TextToDel = "[Unknown]"

$hListView = ControlGetHandle($title, "", "TListView1")
If @error Then
    MsgBox(16, "Error", "Required window not exist")
    Exit
EndIf

$LV_Item = ControlListView($title, "", $hListView, "GetItemCount")

While 1
    If Not _GUICtrlListView_FindText($hListView, $TextToDel, 0) Then ExitLoop
    For $i = 0 To $LV_Item
        If ControlListView($title, "", $hListView, "GetText", $i) = $TextToDel Then _GUICtrlListView_DeleteItem($hListView, $i)
    Next
WEnd

Tested on RegCleaner program.

Share this post


Link to post
Share on other sites

Hello! Try this:

; ...

While 1
    If Not _GUICtrlListView_FindText($hListView, $TextToDel, 0) Then ExitLoop
    For $i = 0 To $LV_Item
        If ControlListView($title, "", $hListView, "GetText", $i) = $TextToDel Then _GUICtrlListView_DeleteItem($hListView, $i)
    Next
WEnd

Tested on RegCleaner program.

Note that deletes vice hides the item. I don't think you can hide individual items, or at least I don't know how.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Note that deletes vice hides the item. I don't think you can hide individual items, or at least I don't know how.

:)

Hello PsaltyDS! I know, my example delete item. I not found function for hiding ListView item, but i suggest any solution. :P

Share this post


Link to post
Share on other sites

Note that deletes vice hides the item. I don't think you can hide individual items, or at least I don't know how.

:D

I gave an example of this here.

Share this post


Link to post
Share on other sites
big_daddy Nice example! I add this in my script collection! Thanks! :D

Share this post


Link to post
Share on other sites

big_daddy Nice example! I add this in my script collection! Thanks! :D

You're welcome! I need to add this to my snippet database as well.

Share this post


Link to post
Share on other sites

I gave an example of this here.

Nicely done! :D

There still doesn't seem to be a hidden state available in the ListView control item properties, but this keeps track of what gets deleted in a Global array, so it can be re-inserted on command, simulating "hide" and "unhide".

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hello! Try this:

#include <GuiListView.au3>

$title = "RegCleaner 4.3 by Jouni Vuorio"
$TextToDel = "[Unknown]"

$hListView = ControlGetHandle($title, "", "TListView1")
If @error Then
    MsgBox(16, "Error", "Required window not exist")
    Exit
EndIf

$LV_Item = ControlListView($title, "", $hListView, "GetItemCount")

While 1
    If Not _GUICtrlListView_FindText($hListView, $TextToDel, 0) Then ExitLoop
    For $i = 0 To $LV_Item
        If ControlListView($title, "", $hListView, "GetText", $i) = $TextToDel Then _GUICtrlListView_DeleteItem($hListView, $i)
    Next
WEnd

Tested on RegCleaner program.

Hi, and thanks for the reply :D , sorry I'm late but is the line in bold the same as _GUICtrlListViewGetItemText?

The reason I'm asking is because I'm using version 3.2.8.1 right now and can't upgrade until I finish this script

because it's too big.

Share this post


Link to post
Share on other sites

?

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