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.

ManagedControl property

Project: Drop Files Components.

Unit: PJDropFiles.

Class: TPJCtrlDropFiles

Applies to: ~>5.0

property ManagedControl: TWinControl;

Description

ManagedControl refers to the associated control for which file drops are managed. If this property is nil then no files drops are handled.

⚠️ Known issue

At some point between Delphi XE and Delphi 12 TPJCtrlDropFiles stopped working correctly when ManagedControl was associated with a TComboBox or related control. Any attempt to drop a file on the managed control is rejected.

The circumstances under which the bug occurs are not fully understood, depends on the value of the combo box’s Style property as follows:

TComboBox.Style property value Behaviour
csSimple File drops are accepted.
csDropDownList File drops not accepted (there is no edit window).
csDropDown (default) File drops not accepted if ManagedControl is set at design time. However, if ManagedControl is cleared then set at run time then File drops are accepted.
csOwnerDrawFixed Not tested, but not expected to work since there is no edit box.
csOwnerDrawVariable Not tested, but not expected to work since there is no edit box.

For a discussion of the problem see issue #6 in the ddablib/dropfiles repository on GitHub.

Workaround

One possible way to work around this issue is to use a TPJDropFiles component instead of TPJCtrlDropFiles. Place a TPJDropFiles component on a form and make it the parent of the TComboBox, then size the TPJDropFiles to the same size as the combo box. The TPJDropFiles should then capture file drops made over the the combo box.