| View previous topic :: View next topic |
| Author |
Message |
MikeG
Joined: 23 Apr 2004 Posts: 34 Location: Adelaide, South Australia
|
Posted: Wed May 03, 2006 1:11 pm Post subject: Need LV_Hide() and LV_Show() for listviews |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed May 03, 2006 1:44 pm Post subject: |
|
|
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 |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1239
|
Posted: Wed May 03, 2006 2:16 pm Post subject: |
|
|
| 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 |
|
 |
MikeG
Joined: 23 Apr 2004 Posts: 34 Location: Adelaide, South Australia
|
Posted: Wed May 03, 2006 10:11 pm Post subject: Oh well :-( |
|
|
| 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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu May 04, 2006 9:40 am Post subject: |
|
|
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 |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Thu May 04, 2006 10:24 am Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu May 04, 2006 11:54 am Post subject: |
|
|
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 |
|
 |
|