How to drag and drop a file onto a Firemonkey form?

  

I am attempting to drag and drop a file from Windows onto a Firemonkey form, but I am running into dead ends. Firstly, I attempted to use a TDropTarget component and followed the steps in this question exactly. However, anytime I drag a file over the TDropTarget component, I just get the “No Symbol” icon as my cursor.

Then I found this question and as per the second answer, I placed a TPanel control on my form and set the OnDragOver and OnDragDrop events. I just placed some debug code inside the events to see if I was getting them to fire like so:

void __fastcall TForm1::Panel1DragOver(TObject *Sender, const TDragObject &Data,
const TPointF &Point, TDragOperation &Operation)
{
ShowMessage(“over”);
}

void __fastcall TForm1::Panel1DragDrop(TObject *Sender, const TDragObject &Data,
const TPointF &Point)

{
ShowMessage(“drop”);
}

However, none of these events are fired when I attempt to drag a file onto the panel. Instead I am greeted with the “No Symbol” icon as my cursor, just as I was with the TDropTarget component.

What do I need to do in order to successfully drag a file onto my form?

Comments are closed.