Description:

Component to help with traversing folder structures.  Will notify 
the caller when file or folder is found.  Files are scanned before 
sub-folders, and both file and folder scans are in alphabetical 
order.

Installation:

Extract the .PAS and the .DCR files from the Zip file to a folder
of your choice, and within Delphi IDE, use the Component, Install... 
option.  You should end up with a new section on your component 
palette entitled "Davids".  You can change the section of the 
palette by editing the source code for the component's Register
procedure.

Usage:

The start of the tree of folders to be scanned is specified in
the InitialDirectory property, and the files to be scanned for are
specified in the FileMask property.  Be sure to set the FileMask to
*.* to scan for all files.  The Recursive property may optionally be 
set false to scan just one directory.

Call the component's ScanTree method to start a tree scan.  This 
scans the whole tree in alphabetical order.  The SearchInProgress 
property will be set to True.  For each file found in a folder, 
the OnFileFound event occurs, with the file name string in the 
FileFound property.  For each sub-folder found in a folder, 
the OnDirectoryFound event occurs, calling back the program with the 
folder name string in the FileFound property.  At the end of each
folder scanned, an OnDirectoryDone event occurs.  This allows you
to update the display, for example, at suitable intervals throughout
the scan (which may take tens of seconds with a wildcard on a full 
disk).

Event order:

With the Recursive property set True

  OnDirectoryFound    (for top folder)
  OnFileFound         (for top folder, 1st file)
  OnFileFound         (for top folder, 2nd file)
  OnFileFound         (for top folder, 3rd file)
     OnDirectoryFound    (for 1st sub-folder)
     OnFileFound         (for 1st sub-folder, 1st file)
     OnFileFound         (for 1st sub-folder, 2nd file)
     OnDirectoryDone     (for 1st sub-folder)
     OnDirectoryFound    (for 2nd sub-folder)
     OnFileFound         (for 2nd sub-folder, 1st file)
     OnFileFound         (for 2nd sub-folder, 2nd file)
     OnDirectoryDone     (for 2nd sub-folder)
  OnDirectoryDone     (for top folder)
  OnSearchDone

With the Recursive property set False

  OnDirectoryFound    (for top folder)
  OnFileFound         (for top folder, 1st file)
  OnFileFound         (for top folder, 2nd file)
  OnFileFound         (for top folder, 3rd file)
  OnDirectoryFound    (for 1st sub-folder)
  OnDirectoryFound    (for 2nd sub-folder)
  OnDirectoryDone     (for top folder)
  OnSearchDone

Notes:

Application messages are processed at the start of each folder in
the tree.  This allows the calling program to process a Stop button
message, and set the Continue variable (e.g. TreeScanner1.Continue) 
to False, to interrupt the scan.  

The program attempts to optimise its use of string lists by using 
the BeginUpdate and EndUpdate around each set of additions, but 
since these lists are non-graphical, I expect there is little gain.


Revison history:

V1.0.0  1996 Dec 15  First version
V1.0.2  1997 Jan 12  Add file mask (e.g. *.exe)
V1.0.4  1997 Mar 28  Add event when leaving folder
                     Add BeginUpdate/EndUpdate around list updates
V1.0.6  1997 Apr 26  Add report of found object size (for files)
                     Add Recursive flag - normally True
                     (suggestions of Sean Mathews)
V1.1.0  1997 May 12  Version for Delphi 3.0
V1.2.0  1997 Sep 14  Version for Delphi 3.01
                     Add "hidden" properties - these will make the routine find
                     Hidden files or folders in addition to the normal ones
                     (suggestion from Paolo Faccini)
V1.2.2  1997 Oct 22  Add OnSearchDone event (suggestions of Ed Butler)
                     Allow for coding error in Borland's RTL in FindClose
V1.3.0  1998 Mar 15  Version for Delphi 3.02
                     Add CommaText for input file spec, allows multiple searches
                     The simple FileMask property overrides FileMaskCommaText

Copyright:

This Freeware component is Copyright  David J Taylor, Edinburgh,
1997-8.  If you change it, I'd appreciate a note so that your 
improvements can be passed on to others in the next version.

david.taylor@gecm.com
1998 March 14
