# Drop Files Components
ReadMe

## Contents

- Description
- Installation
- Demo Programs
- Update History
- License and Disclaimer
- Bugs and Feature Requests
- About the Author

» Contents

## Description

Three components are supplied that support drag and drop from Windows Explorer along with subsidiary components that can filter dropped files. The components are:

- TPJDropFiles
  Container control that catches files dragged and dropped onto its client area or the client area of child controls.
- TPFormDropFiles
  Non-visual component that catches files dragged and dropped from Explorer onto the form that contains the component.
- TPJCtrlDropFiles
  Non-visual component that catches files dragged and dropped from Explorer onto an associated control.
- TPJExtFileFilter
  File filter component that filters files according to their extension.
- TPJWildCardFileFilter
  File filter component that filters files according to a DOS-style wild card.
- TPJFileFilter
  An abstract base class for file filter components.

Some design time assistance is provided by component and property editors.

Key features of the drop files components are:

- An OnDropFiles event is triggered when files are dropped.
- The names of dropped files are made available through the Files[] array property. For convenience, the name of the first file is also stored in the FileName property.
- The list of dropped files can be configured to include only files, only folders or all files and folders.
- Dropped folders can be recursed so that all the files and sub-folders in each of the dropped folders are listed.
- Filters can be applied to the dropped files and folders. This is done in one of two ways:
  - By handling the OnFileFilter event and deciding which files and folders to pass through the filter.
  - By linking the drop file component to a special file filter component, derived from the abstract TPJFileFilter. In this case the dropped files are automatically filtered by the filter component. Two filter components are provided: TPJExtFileFilter that filters according to file extensions and TPJWildCardFileFilter that filters using DOS-style wild-cards. Developers can create further filter components by deriving from TPJFileFilter.
- The mouse co-ordinates where the files were dropped can be retrieved, as can a reference to any control under the mouse cursor at the time.
- The OnBeforeDrop event can be used to do pre-processing before the files are actually dropped.
- The IsFolder[] array property informs if an equivalent item in the Files[] property is a file or a folder.
- The owning window can be brought to the front when files are dropped.

### Compatibility

The components have been tested on Delphi 7 to XE4 Windows compilers (except Delphi 2005) and the Delphi XE2 to XE4 64 bit compilers. The components are thought to compile on compilers back to Delphi 3, but that is not guaranteed.

The components are for use with the VCL only: they are not compatible with FireMonkey.

.NET and non-Windows platforms are not supported.

» Contents

## Installation

The Drop Files Components, their documentation and the demo program are supplied in a zip file. Before installing you need to extract all the files from the zip file, preserving the directory structure. The following files will be extracted:

- `PJDropFiles.pas` – component source code.
- `PJDropFiles.dcr` – component palette glyphs.
- `PJDropFilesDsgn.pas` – property editors and component registration source code.
- `PJDropFilesDsgn.dfm` – property editor form.
- `PJDropFiles.hlp` – component help file that integrates with the Delphi 3-7 OpenHelp system.
- `PJDropFiles.als` – a-link keyword file for integration with the Delphi 6 or 7 OpenHelp system.
- `ReadMe.htm` – this file.
- `ChangeLog.txt` – component's change log.
- `MPL-2.txt` – the Mozilla Public License v2.0.
- `Documentation.URL` – short-cut to the component's online documentation.

In addition to the above files you will find the source code of two demo projects the `Demo\1` and `Demo\2` sub-directories.

You can now install the components into the Delphi IDE. To do this, the files `PJDropFiles.pas`, `PJDropFiles.dcr`, `PJDropFilesDsgn.pas` and `PJDropFilesDsgn.dfm` should be added to a design time package. If you need help doing this see here.

Note that the help file included in the download can only integrate with the IDE in Delphi 3-7. For information on how to do this, see this article. Users of other versions of Delphi can either use the help file as a stand-alone file (in which case some links won't work) or you can use the Drop Files Components online documentation.

NOTE: The help file is deprecated and is no longer being updated. The last update was in the v5.0.3 release. Any changes and new features added since then have not been included in the help file. For up to date documentation please refer to the online documentation.

» Contents

## Demo programs

The source code for two demo programs is included in the download:

1. The main demo program exercises all three drop files components and the filter components.
2. A program that demonstrates how to use TPJCtrlDropFiles with frames.

Both demo programs require Delphi 7 as a minimum. They are both compatible with the Delphi 32 bit and 64 bith Windows compilers.

For more information about the demos see the file `ReadMe.txt` in the `Demos` directory.

» Contents

## Update History

A complete change log is provided in a text file that is included in the download.

» Contents

## License and Disclaimer

These components are released under the terms of the Mozilla Public License v2.0.

All relevant trademarks are acknowledged.

» Contents

## Bugs and Feature Requests

Bugs can be reported or new features requested via the Issue Tracker.

If no similar report or request has been recorded already, use the New Issue link to add a new issue. Please select the most appropriate template from the Templates drop down list.

» Contents

## About the Author

I'm Peter Johnson – a hobbyist programmer living in Ceredigion in West Wales, UK, writing write mainly in Delphi. My programs and code are available from http://www.delphidabbler.com/.

I can be contacted via the website.

Please let me know if you have any comments about the component, but please use the Issue Tracker noted above to report bugs and request new features.
This document is copyright © 2005-2013, P D Johnson, www.delphidabbler.com