Event 'OnAddFolder' of ShellTreeView lazarus / 31-LCL ---------------------------------------------------------------------- Edson · 2014-09-29 01:03 I was trying to implement a filter on a ShellTreeView, and searching for the Web, I found that in Delphi, there is the event OnAddFolder. But I can't find this event on the the ShellTreeView of Lazarus. ---------------------------------------------------------------------- derek.john.evans · 2014-09-29 07:34 It looks like there is no notify event or virtual method you can override. So, your options are to either hack the code, find another component, or write a treeview filter. There is TTreeFilterEdit in the LazControls tab, but that doesn't sound like what you want. So, try this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses Masks, ShellCtrls; procedure ShellTreeViewFilter(const AShellTreeView: TShellTreeView; const AInclude, AExclude: String);var  LIdx: Integer;  LFilename: String;begin  for LIdx := 0 to AShellTreeView.Items.Count - 1 do  begin    LFilename := AShellTreeView.GetPathFromNode(AShellTreeView.Items[LIdx]);    AShellTreeView.Items[LIdx].Visible := MatchesMaskList(LFilename, AInclude) and not MatchesMaskList(LFilename, AExclude);  end;end;   Then you need to access OnAddition which is not published by TShellTreeView. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFormMain.FormCreate(Sender: TObject);begin  TTreeView(ShellTreeView).OnAddition := @DoOnAddition;  TTreeView(ShellTreeView).OnAddition(ShellTreeView, nil);end; procedure TFormMain.DoOnAddition(Sender: TObject; Node: TTreeNode);begin  ShellTreeViewFilter(Sender as TShellTreeView, 'c:*', 'c:\windows;c:\program files;c:\intel;c:\Documents and Settings;c:\SYSTEM.SAV');end;     The code above will filter only folders on the C:\ drive, and exclude some common system folders. Note: I had problems getting file attributes using this method, so you may have to look at other ideas if you are filtering by file attribute. The following shows the lazarus folder excluding all 'c:\lazarus\d*' Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFormMain.FormCreate(Sender: TObject);begin  ShellTreeView.Root := 'c:\lazarus';  TTreeView(ShellTreeView).OnAddition := @DoOnAddition;  TTreeView(ShellTreeView).OnAddition(ShellTreeView, nil);end; procedure TFormMain.DoOnAddition(Sender: TObject; Node: TTreeNode);begin  ShellTreeViewFilter(Sender as TShellTreeView, 'c:\lazarus\*', 'c:\lazarus\d*');end; ---------------------------------------------------------------------- Bart · 2014-09-29 08:21 TShellTreeView needs an implementation on WS level, so that on Windows it properlys shows "Desktop -> My Computer" etc. This will need a major rewrite though. Bart ---------------------------------------------------------------------- Edson · 2014-09-29 15:14 Thanks for the responses. I can see that TShellTreeView is not so developed as his equivalent in Delphi. Quote from: derek.john.evans on September 29, 2014, 09:34:32 amNote: I had problems getting file attributes using this method, so you may have to look at other ideas if you are filtering by file attribute. Sadly, I work with drives, files and folders, so I need to access to file attributes. I was using a TreeView for implementing a File explorer, but I wanted to use TShellTreeView instead.