Page 1 of 1

Show search-results in Treeview

Posted: 01 Oct 2004, 09:35
by BernhardH
The control looks great!

If I can solve the following question the control is exactly that what I was searching for weeks!

I want to display search results of files and/or folders in the treeview. When searching for files (I have already a component which returns the results in an array), the results should be shown in the treeview.
So the treeview should look like in the sample "TechDemo" but with filtered items.

Thanks for any answer!
Bernhard

Posted: 01 Oct 2004, 11:29
by TiKu
Hi!

Do the search results have the same hierarchical structure as the file system? Let's say you have the following structure:

Code: Select all

Folder 1
   |-- Folder 2
      |-- File 3.txt
      |-- File 4.bat
   |-- File 1.txt
   |-- File 2.bat
And you want to search for txt files. Does the result you want to display look like this (having File 3 and File 1 on the same level):

Code: Select all

File 3.txt
File 1.txt
Or more like this (keeping the original structure):

Code: Select all

Folder 1
   |-- Folder 2
      |-- File 3.txt
   |-- File 1.txt
The first one is impossible, but I'll try to make this possible in ExplorerListView. The second one may be achieved by using the filter features of ExplorerTreeView, namely: IncludedItems, FileFilters, FolderFilters, FireBeforeInsertItem and so on. E. g. you could use FireBeforeInsertItem and in the BeforeInsertItem event check whether the item that is to be inserted is in your array.

HTH
Timo

Posted: 01 Oct 2004, 18:01
by BernhardH
Hi Timo,

thank you for your answer.
The second one is that what I wanted (optics). The point is that I get already the search results of files (e.g.) in an array. I think it's impossible to feed them to the control?

Bernhard

Posted: 01 Oct 2004, 18:50
by TiKu
BernhardH wrote:The second one is that what I wanted (optics). The point is that I get already the search results of files (e.g.) in an array. I think it's impossible to feed them to the control?
Yes, that's not possible. ExplorerTreeView 1.x doesn't support user-defined items and user-defined items that are treated as shell-items (including ContextMenus, AutoUpdate and so on) are something I haven't even thought about so far. :|
But I'll think about it and maybe implement it in ExplorerTreeView 2.0.

So I'm afraid you'll either have to use the filter features or use a common treeview. If you decide to do the latter and have problems with the Shell API, feel free to ask me for help.

Best regards.
Timo