Difference between revisions of "Drop files event"
From Free Pascal wiki
Jump to navigationJump to searchm (→Related bug reports: Bugreports have status "Closed".) |
|||
(12 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | The files | + | The drop files event will be invoked when the user drops one or multiple dragged files on one of application's forms. |
First this event should be fired for target form (or main form if drop target is unknown), then for the application. | First this event should be fired for target form (or main form if drop target is unknown), then for the application. | ||
Line 5: | Line 5: | ||
== Possible implementation for LCL == | == Possible implementation for LCL == | ||
− | + | TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of Object; | |
− | Add | + | Add OnDropFiles: TDropFilesEvent to TCustomForm, TApplication and TApplicationProperties. |
+ | Each form will have property AllowDropFiles: Boolean, which enables this event. | ||
− | + | ==Possible implementation per widgetsets== | |
− | + | The widgetsets should call method IntfDropFiles of target form (or main form if drop target is unknown) and the application. | |
===Win32/64=== | ===Win32/64=== | ||
Line 19: | Line 20: | ||
===GTK1/2=== | ===GTK1/2=== | ||
+ | * enable: gtk_drag_dest_set | ||
+ | * respond to drag_data_received signal | ||
===Qt=== | ===Qt=== | ||
+ | |||
+ | * enable widget by setAcceptDrops(true) | ||
+ | * respond to dragEnterEvent by event->acceptProposedAction for mime-type text/uri-list | ||
+ | * respond to dropEvent | ||
+ | * docs: [http://doc.trolltech.com/4.2/dnd.html#dropping] | ||
===Carbon=== | ===Carbon=== | ||
* respond to kAECoreSuite/kAEOpenDocuments event to open application associated files | * respond to kAECoreSuite/kAEOpenDocuments event to open application associated files | ||
− | * | + | * modify Application Bundle |
== Related bug reports == | == Related bug reports == | ||
− | * [http://www.freepascal.org/mantis/view.php?id=1772 bug 1772] | + | * <s>[http://www.freepascal.org/mantis/view.php?id=1772 bug 1772]</s> |
− | * [http://www.freepascal.org/mantis/view.php?id=8976 bug 8976] | + | * <s>[http://www.freepascal.org/mantis/view.php?id=8976 bug 8976]</s> |
==TODO== | ==TODO== | ||
− | # | + | # <s>implement for Qt</s> already implemented (during 0.9.27) |
− | + | ||
− | + | [[Category: Event-driven programming]] |
Latest revision as of 17:12, 5 April 2017
The drop files event will be invoked when the user drops one or multiple dragged files on one of application's forms.
First this event should be fired for target form (or main form if drop target is unknown), then for the application.
Possible implementation for LCL
TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of Object;
Add OnDropFiles: TDropFilesEvent to TCustomForm, TApplication and TApplicationProperties. Each form will have property AllowDropFiles: Boolean, which enables this event.
Possible implementation per widgetsets
The widgetsets should call method IntfDropFiles of target form (or main form if drop target is unknown) and the application.
Win32/64
- set DragAcceptFiles for every form
- respond to WM_DROPFILES message
GTK1/2
- enable: gtk_drag_dest_set
- respond to drag_data_received signal
Qt
- enable widget by setAcceptDrops(true)
- respond to dragEnterEvent by event->acceptProposedAction for mime-type text/uri-list
- respond to dropEvent
- docs: [1]
Carbon
- respond to kAECoreSuite/kAEOpenDocuments event to open application associated files
- modify Application Bundle
Related bug reports
TODO
implement for Qtalready implemented (during 0.9.27)