| Class TFileList (unit AmedeoFileList) |
TFileList is a TListView clone wich behaves like Windows Explorer's file window
| Constructors |
constructor Create (aOwner :TComponent);////////////////////////////////////////////////////////////////////////////// CLASS METHODS FOR TFileList ////////////////////////////////////////////////////////////////////////////// Object creation
| Functions |
function AddFile (FileName :TFileName) :TListItem;
procedure AddMask (Mask :string);Add specifications to File Specifications list
procedure AddPath (Path :string);Add specifications to Search Path List
destructor Destroy;
function IsDirectory (Item :TListItem) :boolean;////////////////////////////////////////////////////////////////////////////// PROCESSING & SERVICES ROUTINES //////////////////////////////////////////////////////////////////////////////
procedure SetColCaption (Col: TFileInfo; Value :string);
procedure SetColWidth (Col: TFileInfo; Value :integer);
procedure SetupFileColumns;Builds columns for ListView NAME and SIZE column always created and just hidden if not required.
procedure AddFileData (NewItem :TListItem; Path :string; FindData :TWin32FindData);
procedure ColClick(Column: TListColumn);////////////////////////////////////////////////////////////////////////////// EVENT HANDLERS ////////////////////////////////////////////////////////////////////////////// overrides ancestor's handler for column headers click: calls first the Set Sort Column procedure and then the inherited ColClick method.
function GetMask :string;
function GetPath :string;Get Search Path List
procedure Loaded;
procedure SetDisplayDir (Display :boolean);Allows/Prevent loading of Directory Items in the file list
procedure SetDisplayParentDir (Display :boolean);Allows/Prevent loading of Parent Directory Items in the file list
procedure SetFileTypes (FT :TFileTypes);////////////////////////////////////////////////////////////////////////////// PROPERTIES INTERFACE ////////////////////////////////////////////////////////////////////////////// Set File Attributes
procedure SetMask (Mask :string);
procedure SetPath (Path :string);Set Search Path List
procedure SetSortColumn (Column :TFileInfo);Set current sort column
procedure SetViewColumns (Columns :TFileInfos);
procedure SetupFileColumnInfos;Sets up columns infos for ListView
procedure UpdateFileList;Update File List with contents of the directory specified in fDirectory
| Properties |
property Directory : string
property DisplayDirectory : boolean
property DisplayParentDir : boolean
property FileTypes : TFileTypes
property Mask : string
property SortColumn : TFileInfo
property ViewColumns : TFileInfos| Events |
event OnFileAdd : TFLInsertEvent| Variables |
fDirectory : TPatternList;
fDisplayDir : boolean;
fDisplayParentDir : boolean;
fFileMask : TStringList;
fFileTypes : TFileTypes;
fOnFileAdd : TFLInsertEvent;
fSortColumn : TFileInfo;
fViewColumns : TFileInfos;| Constructors |
constructor Create (aOwner :TComponent);Public declarations
////////////////////////////////////////////////////////////////////////////// CLASS METHODS FOR TFileList ////////////////////////////////////////////////////////////////////////////// Object creation
| Functions |
function AddFile (FileName :TFileName) :TListItem;protection against index error
procedure AddMask (Mask :string);add a file
Add specifications to File Specifications list
procedure AddPath (Path :string);Add file specifications
Add specifications to Search Path List
destructor Destroy;Object deletion
function IsDirectory (Item :TListItem) :boolean;Add search path specifications
////////////////////////////////////////////////////////////////////////////// PROCESSING & SERVICES ROUTINES //////////////////////////////////////////////////////////////////////////////
procedure SetColCaption (Col: TFileInfo; Value :string);////////////////////////////////////////////////////////////////////////////// INITIALIZATION //////////////////////////////////////////////////////////////////////////////
procedure SetColWidth (Col: TFileInfo; Value :integer);set column caption
procedure SetupFileColumns;set column width
Builds columns for ListView NAME and SIZE column always created and just hidden if not required. Other columns are created only if requested
procedure AddFileData (NewItem :TListItem; Path :string; FindData :TWin32FindData);Add a file entry to the list view. The FindData structure should be returned from a FindFirstFile/FindNextFile call
procedure ColClick(Column: TListColumn);Protected declarations
////////////////////////////////////////////////////////////////////////////// EVENT HANDLERS ////////////////////////////////////////////////////////////////////////////// overrides ancestor's handler for column headers click: calls first the Set Sort Column procedure and then the inherited ColClick method.
function GetMask :string;Get File Specifications list
function GetPath :string;Get file specifications
Get Search Path List
procedure Loaded;ignore duplicates
procedure SetDisplayDir (Display :boolean);Get search path list
Allows/Prevent loading of Directory Items in the file list
procedure SetDisplayParentDir (Display :boolean);enable/disable list of dirs
Allows/Prevent loading of Parent Directory Items in the file list
procedure SetFileTypes (FT :TFileTypes);enable/disable list of dirs
////////////////////////////////////////////////////////////////////////////// PROPERTIES INTERFACE ////////////////////////////////////////////////////////////////////////////// Set File Attributes
procedure SetMask (Mask :string);Set File Specification
procedure SetPath (Path :string);Set file specifications
Set Search Path List
procedure SetSortColumn (Column :TFileInfo);Set search path specifications
Set current sort column
procedure SetViewColumns (Columns :TFileInfos);Set current column set
procedure SetupFileColumnInfos;scan the directory and load file list
Sets up columns infos for ListView
procedure UpdateFileList;chance to add custom info
Update File List with contents of the directory specified in fDirectory
| Properties |
property Directory : stringclass specific published properties} // The Directory property lets you specify a directory or a list of directories. // Upon change the specified paths will be used to retrieve and load matching files. // Use the Mask property to specify a file mask or a list of file masks. // List of paths and/or file masks may be separated by commas or semicolumns. // Setting the Directory property to a null string will prevent directory scan and // allow manual file loading.
property DisplayDirectory : boolean
property DisplayParentDir : boolean
property FileTypes : TFileTypes
property Mask : string
property SortColumn : TFileInfo
property ViewColumns : TFileInfos| Events |
event OnFileAdd : TFLInsertEvent| Variables |
fDirectory : TPatternList;file attributes
fDisplayDir : boolean;file specifications list
fDisplayParentDir : boolean;include directories in file scan
fFileMask : TStringList;current directory
fFileTypes : TFileTypes;Private declarations
fOnFileAdd : TFLInsertEvent;current sort column
fSortColumn : TFileInfo;visible columns
fViewColumns : TFileInfos;show '..' directory