Sign in Join
Wiki copytemporary

Drop files event: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11The drop files event will be invoked when the user drops one or multiple dragged files on one of application's forms.
22
33First this event should be fired for target form (or main form if drop target is unknown), then for the application.
44
55## Possible implementation for LCL
66
7-`TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of Object;`
7+``` pascal
8+TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of Object;
9+```
810
911Add OnDropFiles: TDropFilesEvent to TCustomForm, TApplication and TApplicationProperties. Each form will have property AllowDropFiles: Boolean, which enables this event.
1012
1113## Possible implementation per widgetsets
1214
1315The widgetsets should call method IntfDropFiles of target form (or main form if drop target is unknown) and the application.
1416
1517### Win32/64
1618
1719- set DragAcceptFiles for every form
1820- respond to WM_DROPFILES message
1921
2022### GTK1/2
2123
2224- enable: gtk_drag_dest_set
2325- respond to drag_data_received signal
2426
2527### Qt
2628
2729- enable widget by setAcceptDrops(true)
2830- respond to dragEnterEvent by event-\>acceptProposedAction for mime-type text/uri-list
2931- respond to dropEvent
3032- docs: [1](http://doc.trolltech.com/4.2/dnd.html#dropping)
3133
3234### Carbon
3335
3436- respond to kAECoreSuite/kAEOpenDocuments event to open application associated files
3537- modify Application Bundle
3638
3739## Related bug reports
3840
3941- [bug 1772](http://www.freepascal.org/mantis/view.php?id=1772)
4042- [bug 8976](http://www.freepascal.org/mantis/view.php?id=8976)
4143
4244## TODO
4345
44461. implement for Qt already implemented (during 0.9.27)
4547
4648---
4749*From the Free Pascal wiki, page "Drop files event", as it stood on 2017-04-05 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
4850Category: Event-driven programming

Back to history