How to handle Drag&Drop events for controls with TLayout as parent
<p>I have some problems implementing drag&amp;drop functionality.</p>

<p>I'm using Delphi XE7 Update 1, Win32.</p>

<p>Here is the sample code in order to demonstrate my case.</p>

<pre><code>unit Drag_Drop;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo, FMX.Layouts, FMX.ListBox,
  FMX.StdCtrls, FMX.Objects;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    ListBox1: TListBox;
    ListBox2: TListBox;
    Layout1: TLayout;
    Memo1: TMemo;
    procedure ListBoxDragOver(Sender: TObject; const Data: TDragObject; const Point: TPointF;
      var Operation: TDragOperation);
    procedure ListBoxDragDrop(Sender: TObject; const Data: TDragObject; const Point: TPointF);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.ListBoxDragDrop(Sender: TObject; const Data: TDragObject; const Point: TPointF);
begin
  Memo1.Lines.Add(Format('%s has dropped on %s', [(Data.Source as TControl).Name, (Sender as TControl).Name]));
end;

procedure TForm1.ListBoxDragOver(Sender: TObject; const Data: TDragObject; const Point: TPointF;
  var Operation: TDragOperation);
begin
  Memo1.Lines.Add(Format('%s is over on %s', [(Data.Source as TControl).Name, (Sender as TControl).Name]));
end;

end.
</code></pre>

<p>I run FMX project with only form (Form1).</p>

<p>I put a TLabel control (Label1), two TListBox controls (ListBox1, ListBox2), TLayout control (Layout1) and TMemo (Memo1) control on the form.</p>

<p>Label1's property 'HitTest' is set to True and 'DragMode' is set to dmAutomatic.</p>

<p>Memo1 is used as the logging tool.</p>

<p>ListBox1 has Form1 as parent control</p>

<p>ListBox2 has Layout1 as a parent control. ListBox2 has value 'Client' for Align property.</p>

<p>Both ListBox1 and ListBox2 controls have event handling procedures:</p>

<p>(a) ListBoxDragDrop for OnDragDrop event;</p>

<p>(b) ListBoxDragOver for OnDragOver event.</p>

<p>With the running program the Label1 is dragged and dropped on ListBox1 successfully which can be checked by Memo1 output.</p>

<p>But trying to drag and drop the Label1 on ListBox2 has nothing as a result. No any of two drag&amp;drop events is triggered.</p>

<p>I found out that having TLayout control as one of parent control makes dragging and dropping impossible for its children.</p>

<p>If I use TPanel control as the only parent for the ListBox2 everything is going well, both drag&amp;drop events are triggered. But in case if I use the chain of Tlayout -> TPanel -> TListBox controls the TListBox control is not able "to listen" drag&amp;drop events.</p>

<p><strong>Why does it happen with TLayout and what can I do to handle drag&amp;drop events for controls which have TLayout as a parent control?</strong></p>