[Lazarus] Drag-n-Drop usage?

Michael Van Canneyt michael at freepascal.org
Tue Sep 14 14:12:56 CEST 2010



On Tue, 14 Sep 2010, Graeme Geldenhuys wrote:

> Hi,
>
> I have searched the web for some Drag-n-Drop examples (even with
> Delphi - just to broaden my search). Most of the examples are in the
> form of this:
>
> procedure TForm1.FormDragDrop(Sender, Source: TObject; X, Y: Integer) ;
> begin
>    if Source is TImage then
>    begin
>      TImage(Source).Left := X;
>      TImage(Source).Top := Y;
>    end;
> end;
>
> procedure TForm1.FormDragOver(Sender, Source: TObject; X, Y: Integer;
> State: TDragState; var Accept: Boolean) ;
> begin
>    Accept := (Source is TImage) ;
> end;
>
>
> Well, this seems pretty useless to me, because that means dragging
> between VCL control to VCL control. Other Windows applications for
> example will not have a TImage class. So how is Delphi (and thus
> Lazarus) handle dragging from external (.NET, Mono, MFC, GTK2, KDE
> etc) applications to a VCL or LCL application?  What is the value and
> type of Source parameter  then?  Where do you find the actual data
> being dragged in? Where do you tell it what data (mime types) you want
> to allow?

On windows, you can only intercept the dropfiles message, which always
comes from the explorer and has a well-known format.

There is no general inter-application drag and drop mechanism.

I don't see how you could implement it in the first place.

Michael.





More information about the Lazarus mailing list