Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#6

Re: Virtual file-view (tree and list)

  Alt 9. Apr 2009, 11:56
To retrieve files from a directory on your hard drive use the Hier im Forum suchenFindAllFiles function that has been posted here in the forum.

To store the content I would suggest that your write your own Class and/or Object structure, which represents a hierarchial structure (like in a 'Tree'). For example, you write a class called "TFolder" containing a List (e.g. a StringList) of a files you have in it and then you have a seperate List of "SubFolders" (TObjectList containing other TFolder instances for example). Using the List-Classes you can easily switch items between single instances of TFolder.

The easiest way to display those element would be (as seen in your screenshot) to have a tree containing just the folders on the left, and then a list that contains all elements (files & folders) from the selected or the root Folder on the left.

When using TTreeView you have to replicate the tree-like structure from your classes (here TFolder). You create a TTreeNode for each TFolder object by using TreeView.Items.AddChild Use the "Parent" Parameter of this method to represent the hierarchial structure of TFolder.

Greets,
David F.

May the source be with you, stranger.
PHP Inspection Unit (Delphi-Unit zum Analysieren von PHP Code)
  Mit Zitat antworten Zitat