Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

TPJDropFiles

Project: Drop Files Components.

Unit: PJDropFiles.

Applies to: ~>5.0

This component provides a window which can accept files dragged and dropped from Windows Explorer. The component handles WM_DROPFILES messages to do this. This control can contain child components (in a similar way to TPanel components). Files dropped over any such child component are also accepted by the parent TPJDropFiles component.

The main use for TPJDropFiles is when you need to detect file drops on non-windowed components such as TLabel or TShape. To do this drop a TPJDropFiles on a form, size it to suit, then place the required non-windowed control(s) on top of the TPJDropFiles control, aligning and sizing the components as required.

Methods

Method Description
Paint Paints the outline of the component at design time. Does nothing at run time.

Properties

Only those properties added or modified by TPJDropFiles are listed here. All other inherited properties are omitted.

Property Description
Count This read-only property returns the number of files dropped on the control.
DropControl This read only property references the control that the files were dropped on.
DropPoint This read only property gives the mouse coordinates where the files were dropped.
Enabled Inherited from TCustomControl. See Delphi help for details.
FileName The name of the file dropped on the control.
Files The names of the most recent files dropped on the control.
Filter References a file filter component used to filter the names of dropped files.
ForegroundOnDrop Causes the owning window to be brought to front when files are dropped.
IsFolder Tells whether each of the dropped files is a folder or a file.
Options Determines how the dropped files are processed and which files are stored in the Files property.
PassThrough Causes drop files messages to be passed through to the owning form.

Events

Event Description
OnBeforeDrop Event that occurs just before files dropped on the control are processed.
OnDropFiles Event that occurs when files are dropped on the component’s window.
OnFileFilter Event that occurs for each file and folder processed and allows for custom filtering of files.