Renamed from FileList.pas 6/14/1998 Paul Rice to avoid conflicts with others' work.
FileList - File ListView components for Delphi 2
© Amedeo Lanza
note for Delphi 3 users:
I did not test it with Delphi 3 nor NT, but some users reported me this
works fine with them.
I had a report (and fixed upon suggestion) of a warning message under NT (see
v2.0 release notes)
Also I had a report (for Delphi 3) of GPF starting the program with
the MultiSelect property set to true. I did not fix this as I tested it with
new version (and Delphi 2), and did not find such problem.
description:
TFileView is a ListView which links system image lists on creation and can
accept files dropped from Windows' Explorer.
TFileList is a FileView descendant wich encapsulates some system functions to
mix ancestor's capability with the FileListBox's Directory and Mask properties.
Thus specifying a path name and a file mask, the control will be filled with
the list of matching files, showing proper icons and a customizable set of file
informations (more than found in the Explores's file window).
The reference section of this source was removed, so PLEASE SEE DOCUMENTATION
FOR REFERENCE about the controls in this source.
copyright & license
This source is Copyright © of Amedeo Lanza di Casalanza. You may freely use,
modify and distribute this software for non commercial purposes and for writing
freeware and/or shareware software. You MAY NOT SELL this software although you
may include it in software collection you distribute, provided there is no
charge for the software itself. Please leave the copyright information and any
additional information (readme.* ecc.) provided with the original author's
copy.
Use of this software for building of commercial programs should be expressely
authorized by the author.
Any use of this software for illegal activities is prohibited.
If you enhance this software or fix any bug, please send the new source to
the author.
usage:
Drop a TFileList and some controls to handle Directory and File Mask
selections, then add some line of code to set the Directory and Mask
properties of TFileList upon selection from other controls ...just as you
where using a TFileListBox control :-)
dependencies:
Marcus Stephany's MASKSEARCH utility unit is needed. You may find it on DSP
in the MSTGREP.ZIP archive in Delphi 2.0 freeware section.
comments:
uses FindFirstFile, FindNextFile and FindClose API calls from Windows unit to
retrieve file list with better performances and ShGetFileInfo to retrieve
extended informations.
To find help about TWin32FindData look for WIN32_FIND_DATA in the Win32
Programmer's Reference and TWin32FindData in Windows unit (if you have the
RTL sources you can find it in the source\rtl\win directory.
current known limitations :
Tested only with Delphi 2.0 and Win95, requires anyway Win32s,Win95 or WinNT
as uses Win32 API calls.
Handles only File Items, System Resources cannot be displayed as in an
Explorer's window.
Columns order is fixed, and settings of columns' width and caption is quite
trivial; I hope I (or someone else) will be able to add a property editor for
that.
I had several requests about speeding up the item loading and display; i
will try to implement a more effective algorithm but i'm not expert with
threads and specific optimizing techniques. Any help is welcome!
DISCLAIMER:
I ASK NO FEE and I GIVE NO WARRANTY for this software, either expressed or
implied. Use it AT YOUR OWN RISK.
suggestions, bug reports & comments to the author:
Amedeo Lanza di Casalanza
from: Torino, Italy
mailto:amldc@tin.it
http://volftp.tin.it/IT/IT/COLLABORAZIONI/LANZA/index.htm
WARNING FOR EMAIL ABUSE:
*BORLAND DELPHI* related messages are WELCOME, any other use of the author's
email address for unsolicited ADVERTISING is STRICTLY PROHIBITED.
aknowledgement:
Portions of this software come from freeware examples by
Markus Stephany
MirBir.St@T-Online.de
http://home.t-online.de/home/MirBir.St/
wich I found on Delphi Super Page (http://SunSITE.icm.edu.pl/delphi/)
also thanks for hints to the very good "Unofficial Newsletter of Delphi Users"
(UNDU) at http://www.informant.com/undu/index.htm
history:
v2.3 14-nov-1997 - amldc@tin.it
+ moved BeginUpdate before sort order change
+ fixed wrong icon display for '..' directories
v2.2 03-nov-1997 - amldc@tin.it
+ Fixed CheckAttributes routine. Was tested Archive attribute instead of
ReadOnly.
v2.1 20-oct-1997 - amldc@tin.it
+ moved SetupFileColumns from Protected to Public. This allow runtime
creation and proper build of display columns. After creating a TFileList
you should call its SetupFileColumns method.
v2.0a 09-oct-1997 - amldc@tin.it
+ intermediate release for beta tester
+ added boolean function IsDirectory (Item :TListItem), returns if the
specified item is a directory
+ added boolean property DisplayParentDir to enable or disable display of
parent directories ("..") - has a little bug: parents for 1st level folders
(e.g. root pointers) get wrong system icon index. I'll try to fix it by
forcing correct value.
v2.0 25-sep-1997 - amldc@tin.it
+ Wrong item was reported when "\" leaking at end of used path. Fixed by
ensuring loaded path strings always end with a "\".
+ Added check to prevent SortColumn being set to unused column.
+ Splitted code, inserted TFileListView as ancestor and TFileView.
TFileListView embeds System Image List handling and File Drop
+ AddFile is now a virtual method for both types and behave quite in a
different way: in TFileView provides to get the needed informations
+ Added OnFileAdd property
+ Added ability to get files dropped from Explorer
+ Added fix to avoid warning message under WinNT when setting directory to an
empty drive (thanks to Sebastian Hildebrandt )
+ Updated for my modified version of MaskSearch (with case match handling).
This feature is not fully tested.
v1.1 14-sep-1997 - amldc@tin.it
+ Added SetupFileColumns in SetColWidth, needed if changing widths when
component visible.
+ Modified SetDirectory to allow empty directory and skipping of directory
scan.
+ Added support for directory list specification.
+ Added usage of Marcus Stephany's MaskSearch unit (see dependencies note
above) for file search and support for file mask list specification.
+ Added FileTypes property for file attribute based filtering
+ DOS file name (cAlternateFilename) forced to Win file name (cFilename) when
returned empty (in Win32FindData) from FindFirstFile and FindNextFile.
+ Added fiDosExt column (mainly for DOS extension based sorting)
+ Added fiAll (display all columns) and modified default set of columns to
reflect the Explorer's one.
v1.0 10-aug-1997 - amldc@tin.it
+ first development
TFileList - TFileList is a TListView clone wich behaves like Windows Explorer's file window
TFileListView -
TFileView - Just exports the needed inherited properties
TPatternList - ///////////// TFileList // ///////////// specialized list for patterns handling
TTypeIconList - System ListView
Register - ////////////////////////////////////////////////////////////////////////////// class registration //////////////////////////////////////////////////////////////////////////////
TColumnInfo
TColumnInfos
TFileDropEvent
TFileInfo
TFileInfos
TFileType
TFileTypes
TFlInsertEvent
TInfoColumn
procedure Register;
////////////////////////////////////////////////////////////////////////////// class registration //////////////////////////////////////////////////////////////////////////////
TColumnInfo = record
Caption : TCaption;
Width : integer;
Alignment : TAlignment;
Column : integer;
end;
Column settings structure
TColumnInfos = array [TFileInfo] of TColumnInfo;
Column Number
TFileDropEvent = procedure(Files: Tstrings; X, Y: Integer) of object
callback for Drop file
TFileInfo = (fiName,fiSize,fiType,
fiModified,fiCreated,fiLastAccess,
fiAttributes,fiDosName,fiDosExt,fiPath,fiAll);
file informations (display columns
TFileInfos = Set of TFileInfo
TFileType =({ftDirectory,}ftArchive,ftReadonly,
ftSystem,ftHidden,{ftCompressed,}ftTemporary,ftAll);
file attributes
TFileTypes = Set of TFileType
ftCompressed,
TFlInsertEvent = procedure (Sender: TObject; Item: TListItem; Path: string; FindData :TWin32FindData) of object
callback for items insertion
TInfoColumn = array [0..Ord(Pred(fiPath))] of TFileInfo;