[Lazarus] TShellTreeView and TTreeView

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Dec 8 19:34:37 CET 2008


On Mon, 8 Dec 2008 16:03:37 -0200
"Felipe Monteiro de Carvalho" <felipemonteiro.carvalho at gmail.com> wrote:

> Hello,
> 
> I am trying to implement TShellTreeView. It is a treeview which shows
> the directory structure in the prefered way of the operating system.
> In Windows that would start with My Computer, etc...
> 
> One problem now is with the design. Should it read all existing
> directories (which will cause a delay) or only those visible, or one
> or two levels at once... what do you think? Reading everything may be
> problematic with removable media.

Very problematic. Especially with the linux automounting. 
The best would be using a separate thread and only check the
visible files.

 
> Another problem is using TTreeView. I searched by I can't find how I
> would implement this behavior, for example, having the root and 1
> level visible and then when the user clicks the + symbol the subitems
> for this item are loaded. Should I use the OnExpanding event? In the
> event handler I would create the subitems? A tutorial would be
> great...

You already figured it out. OnExpanding and OnCollapsing are the
events. Feel free to start a tutorial.
See as example:
ide/unitdependencies.pas TUnitDependenciesView.UnitTreeViewExpanding


Mattias



More information about the Lazarus mailing list