AutoHotkey Community

It is currently May 27th, 2012, 11:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: May 3rd, 2006, 2:11 pm 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 3rd, 2006, 2:44 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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).

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 3rd, 2006, 3:16 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Oh well :-(
PostPosted: May 3rd, 2006, 11:11 pm 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2006, 10:40 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2006, 11:24 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2006, 12:54 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Oh, I forgot it was built in the ListView handling:
GuiControl [-|+]Redraw, MyListView

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group