TPJDropFiles and TPJFormDropFiles 5.0.5

By Peter Johnson

Freeware 06 Apr 2015

In category

Components > System > Drag and Drop


Five components are included in this pack. The three major ones enable applications to support Windows Explorer file drag and drop operations. The remaining two subsidiary components link to and filter the files dropped on one of the primary components. The components are:

  • TPJDropFiles: This windowed component catches files dropped anywhere over its window. It can act as a container for other components.
  • TPFormDropFiles: This non-visual component catches files dropped anywhere on its form, including the non-client areas.
  • TPJCtrlDropFiles: This non-visual component catches files dropped on an associated TWinControl or TFrame.
  • TPJExtFileFilter: When linked to a TPJDropFiles or a TPJFormDropFiles this component filters dropped files by extension. One or more extensions can be provided.
  • TPJWildCardFileFilter: Like TPJExtFileFilter except that it filters based on a DOS-style wild-card string.

In addition to the above an abstract base class is provided from which developers can derive other filter components.

Key features of TPJDropFiles, TPJCtrlDropFiles and TPJFormDropFiles 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 such 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 either by linking to a filter component (see above) or by handling the OnFileFilter event and deciding which files and folders to pass through the filter in the event handler.
  • 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 perform pre-processing before the files are actually dropped.
  • The IsFolder array property tells if the equivalent item from Files array is a file or a folder.
  • The owning window can be brought to the front when files are dropped.
  • Some design time assistance is provided by component and property editors.

A OpenHelp compatible help file is included that integrates with the OpenHelp system of Delphi 3 to 7. The help file can be used independently of the Delphi 2005 and 2006 IDEs with some loss of functionality.

The components are also documented in a wiki

Two demo programs are included in the download. The first exercises both drop files components and the related file filtering components. The second shows how to use TPJCtrlDropFiles with frames.


  • Status: Fully functional
  • Source: FW
  • Exe demo: included
  • Size: 82 849kB


  • Delphi 2005 (VCL)
  • Delphi 2006 (Win32)
  • Delphi 2007 (VCL)
  • Delphi 2009
  • Delphi 2010
  • Delphi 4
  • Delphi 5
  • Delphi 6
  • Delphi 7
  • Delphi XE
  • Delphi XE 2
  • Delphi XE3
  • Delphi XE4
  • Delphi XE5
  • Delphi XE2 64-bit