{Unit LsFileExplorer25.pas} ============================================================================== Archive :- FileExpl.zip Components :- TLsDirTreeCombo25 and TLsFilelistView25 w/TLsFilelistView25PopUp Version :- 2.50 (For Delphi 2, 3 & 4) Author :- Leo D. Shih ------------------------------------------------------------------------------ DISCLAIMER :- These components are currently distributed as Freeware, without warranty of any kind, either expressed or implied. In no event shall the author be liable for any problems or damages that may result from the use of these components. However, suggestions for improvement or bug-fixing will be welcome. ============================================================================== 1. Description ============== 1.1 TLSDIRTREECOMBO25 is a ComboBox with a dropdown TreeView, that displays a hierarchical tree of directories of the file system. (TLsDirTreeCombo25 replaces the TLsDirComboBox of the previous version) 1.2 TLsFilelistView25 is a File ListView component. In addition to its normal functions, It also encapsulates SHFileOperation and other Windows API functions to perform various file management tasks, such as cut, copy, paste, rename, delete, open, view and send_to operations on files. It also provides statistics on Disk-FreeSpace, Selected-Numbers and Selected-Size as those available in the Windows Explorer. 1.3 TLsFilelistView25POPUP is LsFilelistView25's Context Menu, containing commands that perform operations on files. 2. Added properties: =================== 2.1 TLsFilelistView25 --------------------- 2.1.1 Published --------------- Directory - Currently selected directory that contains files and/or sub-directories to be displayed in the TLsFilelistView25. Changing the value of this property will update the TLsFilelistView25 to display items in the new directory. DirTree - Provides a simple way to connect TLsFilelistView25 to TLsDirTreeCombo25. FileType - Type of files to be displayed is based on the attributes of files. FileTypes included are ftReadOnly, ftHidden, ftSystem, ftArchive, ftNormal. Mask - Limits which files are displayed. Default mask is '*.*'. To specify multiple masks, separate the file mask spec. with semicolons. DriveFreeSpace- Free space on the current drive, in kB. SelectedNumber- Number of selected items in the current directory. SelectedSize - Total bytes of selected items in the current directory. ShowFolders - Specifies whether or not folders are shown in the TLsFileListView25 together with files. 2.1.2 Public ------------ FileName - The Name of the selected file including the filepath. DirectorySize - Total bytes of files in the current directory, excluding sub-directories, if any. 2.2 TLsDirTreeCombo25 --------------------- 2.2.1 Published --------------- SelectedPath - The Directory Path of the currently selected treenode in the TLsDirTreeCombo25. FileList - Provides a way to connect TLsDirTreeCombo25 to TLsFilelistView25. ExpandRoot - Specifies whether the RootNode is expanded. TreeHeight - Set the Height of the drop-down treeview, default is 195. Glyph - To load an alternative bitmap file to replace the default Glyph in the button (Note:- default Glyph is not included for Delphi 2, you've to input a bitmap for the button). 3. Added Procedures/Functions (Public): ====================================== 3.1 TLsFilelistView25 --------------------- OneLevelUp - A step back in the directory hierarchy. CutCopy() - | | Paste - | |- Perform copy, move, delete or rename operation on files. DeleteItems - | Using CutCopy(0) for Copy and CutCopy(2) for Cut Operation. | RenameFile - | OpenFile - Open executable files or other type of files which have been associated with their respective applications in the Windows Registry. ViewFile - Provides programmers with a quick viewer of *.c, *.cpp, *.dpk, *.dpr, *.h, *.inf, *.ini, *.pas, *.prg, *.txt, *.doc, *.rtf, *.wri and *.bmp files NewFolder - Create a new folder. SetColumnWidth- Set the width of Columns 0 to 4, default widths are: 160, 90, 90, 100, 40. 3.2 TLsDirTreeCombo25 --------------------- OpenPath() - To select a treenode in accordance with the specified directory path. ResetTreeView - Reload the TLsDirTreeView. 4. Installation =============== Unzip FileExpl.zip to any directory, then copy LsFileExplorer25.pas and LsFileExplorer25.dcr to a directory that is in the Lib search path. 4.1 For Delphi version 2x ------------------------- - Choose Component|Install form the Main Menu - From the Install Component dialog, choose Add - From Add Module dialog, click Browse button. - Navigate to your chosen directory and select LsFileExplorer25.pas, then click Open to add it to the Installed Units Box. - click OK to install the components. 4.2 For Delphi versions 3x & 4x ------------------------------- Both components can be added to an existing Package, eg. Samples or Delphi User's Components Package in D3, by following steps: - Choose Component|Install Component; ensure that 'Into existing package' tab is selected and the 'Package file name' is correct. - From Install Component Dialog, click Browse. - In the Unit FileName Dialog, navigate to your chosen directory and select LsFileExplorer25.pas, then click Open. - In the Install Component Dialog, click OK to compile and install the package. - Finally, right-click the Package Editor Diallog and save the package. 5. Notes on Usage ================= If adding both components to an application, they can be mutually connected, through the setting of TLsDirTreeCombo25's 'FileList' property and TLsFilelistView25's 'DirTree' property.(see FileExpl25Demo.dpr) The TLsFilelistView25's Popup Context Menu (popped up by right-click) contains the following menuitems for carrying out file operations: ---------------------------------------------------------------------- Menu Name Commands / Remarks --------------- ------------------------------------------------- Open DblClick View ViewFile --------------- Send To > To open Send_To SubMenu which contains: - Floppy Disk (A:) Any Folder ... , Clipboard as Contents, Clipboard as FileName, Removable Disk(s), and LinkFiles (.LNK) in \Windows\SendTo directory --------------- Cut CutCopy(2) Copy CutCopy(0) Paste Paste --------------- Rename File RenameFile Delete DeleteItems --------------- Attributes FileAttr --------------- New Folder NewFolder ---------------------------------------------------------------------- These file- and folder-management operations can easily be linked to the application's main menu by adding few lines of code. If MultiSelect Property of TLsFilelistView25 is set to True, GetNextItem function can be used to find all selected items. 6. Limitation ============= Since these components are designed mainly for file management, Special DesktopFolders are not retrieved from the shell's namespace and displayed in both components. Loading of TLsFileListView25 is comparatively slower than that of Windows Explorer, particularly for directories with a great number of files. 7 History ========= Version 2.50 ------------ - TLsDirComboBox has been replaced by TLsDirTreeCombo25, in order to provide a hierarchical treeview of the file system. - Add SetColumnWidth() procedure to TLsFileListView25. - Add ShowFolders property to TLsFileListView25. - Add 'Anchors', 'BiDiMode' and 'Constraints' properties for Delphi version 4.xx. - Add Attributes to context menu - Send_To SubMenu has been revised to include LinkFiles in SendTo Directory. - Fix bug in TLsFileListView25's AddFile() function. Version 2.00 ------------ - Use Windows API functions to perform copy, move, rename, delete, and other operations on files. - Add DriveFreeSpace, SelectedNumber and SelectedSize properties. - Also add an Popup Context Menu to TLsFilelistView25 for file operations. Version 1.20 ------------ - Add compiler directives to migrate both components to Delphi version 4. Version 1.10 ------------ - Fix bugs in TLsFilelistView25's Mask property to allow folders and filtered files to be displayed simultaneously. - Fix bugs in TLsDirTreeCombo25's Click procedure. Version 1.00 ------------ - First development. -----------------------------------------------------------------------------}