Recent

Author Topic: [SOLVED] TShellTreeview and filtering  (Read 1132 times)

superc

  • Sr. Member
  • ****
  • Posts: 251
[SOLVED] TShellTreeview and filtering
« on: February 21, 2022, 11:57:55 am »
Hello,

Does the ShellTreeview currently have a filtering mechanism by file/directory name?

I am using lazarus 2.2 and fpc 3.2.3 32bit on Windows 64

thanks in advance.
« Last Edit: February 21, 2022, 12:35:17 pm by superc »

balazsszekely

  • Guest
Re: TShellTreeview and filtering
« Reply #1 on: February 21, 2022, 12:19:04 pm »
Hello,

Does the ShellTreeview currently have a filtering mechanism by file/directory name?

I am using lazarus 2.2 and fpc 3.2.3 32bit on Windows 64

thanks in advance.
Loop through the nodes and hide the one you are not interested in? Like this:
Code: Pascal  [Select][+][-]
  1.   for I := 0 to ShellTreeView1.Items.Count - 1 do
  2.     if SomeCondition then
  3.       ShellTreeView1.Items.Item[I].Visible := False
  4.  

wp

  • Hero Member
  • *****
  • Posts: 13353
Re: TShellTreeview and filtering
« Reply #2 on: February 21, 2022, 12:19:59 pm »
There is an OnAddItem event in which you can set the CanAdd argument to false if you do not want to add the file specified in the other parameters to the tree.
Code: Pascal  [Select][+][-]
  1. type
  2.  TAddItemEvent = procedure(Sender: TObject; const ABasePath: String;
  3.                             const AFileInfo: TSearchRec; var CanAdd: Boolean) of object;
« Last Edit: February 21, 2022, 12:39:44 pm by wp »

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: TShellTreeview and filtering
« Reply #3 on: February 21, 2022, 12:35:07 pm »
both solutions are useful to me, thanks.

 

TinyPortal © 2005-2018