These components will scan a given dir and generate an event each time a new file or directory is found or added.
TDADirScan
will just scan the directoryTDADirScanTreeView
will fill a treeview with its
contentTDADirScanListView
will fill a listviewYou can subclass TDaDirScan if you want other components to be filled.
This component will allow you to separate the content (in this case : file system) from the way it is represented (treeview, listview or other).TSearchRecClass = class
Time: Integer;
Size: Integer;
Attr: Integer;
Name: String;
end;
The data property is filled with
a TSearchRecClass object
TDAFileFoundEvent = procedure(Sender : TObject; FileName : STring;
var CanAdd : boolean) of object;
TDAFileAddedEvent = procedure(Sender : TObject; FileName : STring) of object;
TDADirFoundEvent = procedure(Sender : TObject; DirName : String; var CanAdd
: boolean) of object;
TDADirAddedEvent = procedure(Sender : TObject; DirName : String ) of object;
TDADirEndEvent = procedure(Sender : TObject; DirName : String; FilesFound:
integer) of object;
Levels : integer
RecursiveScan : boolean
AcceptedFiles : TStrings
CompleteData : boolean
Directory : String (runtime)
class function GetFirstDir(Dir : String) : String;
class function IsADir(Name : String) : boolean;
procedure Reload;
OnDirFound : TDADirFoundEvent;
OnDirAdded : TDADirAddedEvent;
OnFileFound : TDAFileFoundEvent;
OnFileAdded : TDAFileAddedEvent;
GetSRForFile
property EmptyDirs : boolean;
property TreeView : TTreeView;
function GetFileNameAtNode(Node : TTreeNode) : String;
procedure FillNode(Node : TTreeNode; DirName : String);
Levels
is
set lowproperty OnDirEnd : TDADirEndEvent;
The listitem data is filled with a string which contains the complete
filename. You can get the other attributes using the function GetSRForFile
TOnAddingSubItems = procedure (Sender : TObject; Item : TListItem;
SRC : TSearchRecClass) of object;
property ListView : TListView;
function GetFileNameForItem(ListItem : TListItem) : String;
OnAddingSubItems : TOnAddingSubItems;