Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Virtual file-view (tree and list) (https://www.delphipraxis.net/132300-virtual-file-view-tree-list.html)

WojTec 9. Apr 2009 10:50


Virtual file-view (tree and list)
 
Hi,

I have some problem - I need to make "virtual file browser", something like browsers in burning software:

http://img175.imagevenue.com/loc202/..._122_202lo.JPG

but I know nothig how to do this. I must add (by drag'n'drop)/remove (also by drag'n'drop)/delete/rename files/folders. Files in virtual view shold have info about original files (such as size, attributes, etc.).

I never used TThreeView. Maybe someone could help? Any example code, please?

mirage228 9. Apr 2009 11:01

Re: Virtual file-view (tree and list)
 
Check out the Delphi-Referenz durchsuchenTShellTreeView and Delphi-Referenz durchsuchenTShellListView Components ;-) [which are included in your Delphi installation]

Alternative: Use VirtualShellTools from www.mustangpeak.net

WojTec 9. Apr 2009 11:19

Re: Virtual file-view (tree and list)
 
Zitat:

Zitat von mirage228
Check out the Delphi-Referenz durchsuchenTShellTreeView and Delphi-Referenz durchsuchenTShellListView Components ;-)

These components I know and using, but I don't need treeview for physical file structure, but for fully virtual tree with draged files from explorer - structure will be stored only in memory (like Nero or similar software - compilation view). I don't have idea how to write this :cry:

mirage228 9. Apr 2009 11:26

Re: Virtual file-view (tree and list)
 
Ah okay, now I have a clue what you mean ;)

To receive dropped files from Windows Explorer in your Application: Hier im Forum suchenWM_DROPFILES, Hier im Forum suchenDragAcceptFiles. You will find a lot of example code with these two search terms.
Once you get the FileName of the dropped file(s), you have to gather the required information (size, file type and so on) to display it in your tree view. (Search for e.g. Hier im Forum suchenGetFileSize and/or browse your Delphi Help ;) )

On information how to add entries with System Images (<- Hier im Forum suchenShGetFileInfo) you may want to search for a tutorial regarding TTreeView (I don't any now, sorry - but maybe the Delphi Help is useful for you as well).
Or you use the even more powerful VirtualTreeView - if you're okay with German, I got a Tutorial for you: http://www.delphi-treff.de/tutorials...rtualtreeview/

WojTec 9. Apr 2009 11:44

Re: Virtual file-view (tree and list)
 
Getting file info is easy, getting associated icons also :)

But I still don't know to implement this virtual tree :cry: Ok, add folders to tree component may be not to hard, but what about any folder content? How to receive and display in list component virtual content from virtual directory (how to remember draged content?)? This is one I don't understand how to write :cry:

PS: I don't speak German :(

mirage228 9. Apr 2009 11:56

Re: Virtual file-view (tree and list)
 
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
Delphi-Quellcode:
TreeView.Items.AddChild
Use the "Parent" Parameter of this method to represent the hierarchial structure of TFolder.

Greets,

WojTec 9. Apr 2009 14:32

Re: Virtual file-view (tree and list)
 
Thank you, I will try :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz