AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need LV_Hide() and LV_Show() for listviews

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
MikeG



Joined: 23 Apr 2004
Posts: 34
Location: Adelaide, South Australia

PostPosted: Wed May 03, 2006 1:11 pm    Post subject: Need LV_Hide() and LV_Show() for listviews Reply with quote

I have a gui containing listview of several hundred items (it's a shopping list application). I would like to have an edit field where a "filter" string is entered, and have the listview hide all lines that don't contain that string while showing matches. I don't want to delete them using LV_Delete() but rather just make them invisible and move following lines up. Then when the filter string changes, show the lines again.

This requires either new built-in LV_Hide() and LV_Show() or for me to create these functions. But I don't really know how to do this, presumably it would require use of PostMessage or SendMessage? Any help would be appreciated.

I understand how to loop through the listview and check each row against the filter string, all I need is a method of hiding/showing a row number.

The alternative is to delete and rebuild the listview every time but this is visually not nice, and also a bit slow.
Back to top
View user's profile Send private message AIM Address
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Wed May 03, 2006 1:44 pm    Post subject: Reply with quote

AFAIK (and I just had a quick look at MSDN to verify), there is no way to hide a listview item, you can only remove them (LV_Delete) (and re-insert them: LV_Insert).
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
evl



Joined: 24 Aug 2005
Posts: 1239

PostPosted: Wed May 03, 2006 2:16 pm    Post subject: Reply with quote

I think PhiLho's right, the standard listview used doesn't support hiding items as far as I'm aware. Probably the best way is to just recereate the listview contents each time as you said, as I doubt it'd be any quicker to use LV_Insert and LV_Delete unless it's just a few items changing.
Back to top
View user's profile Send private message
MikeG



Joined: 23 Apr 2004
Posts: 34
Location: Adelaide, South Australia

PostPosted: Wed May 03, 2006 10:11 pm    Post subject: Oh well :-( Reply with quote

Thanks, looks like I'll need to rebuild the whole list each time then. I had wanted it to be a sort of "filter as you type" but now I'll just rebuild when clicking a button.
Back to top
View user's profile Send private message AIM Address
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Thu May 04, 2006 9:40 am    Post subject: Reply with quote

You may want to check the LockWindowUpdate function: it may allow to freeze the list view display while you update it, then allow to redraw it.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3841
Location: Bremen, Germany

PostPosted: Thu May 04, 2006 10:24 am    Post subject: Reply with quote

You can stop to redraw the listview and turn it on again when the list is filled, this speeds up the process (see manual on listview).

I have a AHK-GUI with a listview of 4250 entries. And I have a filter for several of its fields. And it is working pretty nicely. Maybe you can post a short example of your code and we can help you to optimize it.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Thu May 04, 2006 11:54 am    Post subject: Reply with quote

Oh, I forgot it was built in the ListView handling:
GuiControl [-|+]Redraw, MyListView
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group