Drop files event: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Drop files event
| Old | New | Line | |
|---|---|---|---|
| 1 | + | The drop files event will be invoked when the user drops one or multiple dragged files on one of application's forms. | |
| 2 | + | ||
| 3 | + | First this event should be fired for target form (or main form if drop target is unknown), then for the application. | |
| 4 | + | ||
| 5 | + | ## Possible implementation for LCL | |
| 6 | + | ||
| 7 | + | `TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of Object;` | |
| 8 | + | ||
| 9 | + | Add OnDropFiles: TDropFilesEvent to TCustomForm, TApplication and TApplicationProperties. Each form will have property AllowDropFiles: Boolean, which enables this event. | |
| 10 | + | ||
| 11 | + | ## Possible implementation per widgetsets | |
| 12 | + | ||
| 13 | + | The widgetsets should call method IntfDropFiles of target form (or main form if drop target is unknown) and the application. | |
| 14 | + | ||
| 15 | + | ### Win32/64 | |
| 16 | + | ||
| 17 | + | - set DragAcceptFiles for every form | |
| 18 | + | - respond to WM_DROPFILES message | |
| 19 | + | ||
| 20 | + | ### GTK1/2 | |
| 21 | + | ||
| 22 | + | - enable: gtk_drag_dest_set | |
| 23 | + | - respond to drag_data_received signal | |
| 24 | + | ||
| 25 | + | ### Qt | |
| 26 | + | ||
| 27 | + | - enable widget by setAcceptDrops(true) | |
| 28 | + | - respond to dragEnterEvent by event-\>acceptProposedAction for mime-type text/uri-list | |
| 29 | + | - respond to dropEvent | |
| 30 | + | - docs: [1](http://doc.trolltech.com/4.2/dnd.html#dropping) | |
| 31 | + | ||
| 32 | + | ### Carbon | |
| 33 | + | ||
| 34 | + | - respond to kAECoreSuite/kAEOpenDocuments event to open application associated files | |
| 35 | + | - modify Application Bundle | |
| 36 | + | ||
| 37 | + | ## Related bug reports | |
| 38 | + | ||
| 39 | + | - <s>[bug 1772](http://www.freepascal.org/mantis/view.php?id=1772)</s> | |
| 40 | + | - <s>[bug 8976](http://www.freepascal.org/mantis/view.php?id=8976)</s> | |
| 41 | + | ||
| 42 | + | ## TODO | |
| 43 | + | ||
| 44 | + | 1. <s>implement for Qt</s> already implemented (during 0.9.27) | |
| 45 | + | ||
| 46 | + | --- | |
| 47 | + | *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).* | |
| 48 | + | Category: Event-driven programming |
