On Mon, 20 Aug 2012 17:38:45 +0200 Bernd <[email protected]> wrote: > I have made a working component. See attachment. Use it like this: > > { TForm1 } > > procedure TForm1.FormCreate(Sender: TObject); > begin > DragSource := TFileDragSource.Create(Self); > DragSource.Control := ScrollBox1; > DragSource.OnDragBegin := @OnScrollboxDragBegin;; > DragSource.OnDragEnd := @OnScrollboxDragEnd;; > DragSource.OnGetData := @OnScrollboxGetData;; > end; > > procedure TForm1.OnScrollboxDragBegin(Sender: TObject); > begin > WriteLn('scrollbox drag begin'); > end; > > procedure TForm1.OnScrollboxDragEnd(Sender: TObject); > begin > WriteLn('scrollbox drag end'); > end; > > procedure TForm1.OnScrollboxGetData(Sender: TObject; Data: TStringList); > begin > WriteLn('scrollbox drag get data'); > Data.Append('file:///home/bernd/file_a'); > Data.Append('file:///home/bernd/file_b'); > end; > > Now the Scrollbox on my form will act as a drag source for dragging > files to other applications (In a real world application the OnGetData > handler could for example create these files and supply the file names > and the OnDragEnd could delete them again). Dragging them to the file > manager would copy the files, dragging them to an editor would make it > open them.
Nice. Thanks. Should I add it to the examples or in a package of its own? > Now it wold be nice if one of the local windows API Gurus could extend > this code to also work in windows and maybe someone else make it work > in Qt and on the Mac also. And eventually this code should go directly > into the LCL (maybe after also adding the ability to drag arbitrary > mime types and not only filenames). Yes. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
