[Lazarus] Generalized DragDrop

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat Jan 22 15:25:16 CET 2011


In fpGUI Graeme implemented an interface for inter-process dragging. It 
would be nice to have a similar interace in the LCL, that extends the 
current intra-process dragging.

Why that?
- A more general approach could solve the known problem with docking 
forms, by including dragging by the window manager.
- Drag-drop of files or other objects as an alternative to an OpenDialog.
- Embedding of shared objects (COM, CORBA...)

What's required?

- A generalization of the DragManager, so that visual (DragImage...) and 
application feedback (events) are not restricted to application-internal 
drag sources and implementations. This is not hard to do, all that can 
be handled in the already existing or added specialized DragObjects, 
instead of the (superfluous) DragPerformers.

- A DragObject should include a SourceType property, so that the targets 
can handle more source types, e.g. filenames or COM/CORBA objects, in 
addition to controls. Mime types (strings or enum) can be used for that 
purpose. Further information for inter-process dragging can be added 
(source PID, HWND...), so that an application can distinguish internal 
references (to controls...) from references to objects in other processes.

- The event handlers must have access to the extended source 
information. This is also no problem, since only one drag operation can 
be active at any time, so that a global DragObject reference can be used 
everywhere. A predefined DragObject can be used whenever an external 
object is being dragged over an application form.

- More drag and drop types should be defined, in addition to "drop" and 
"dock", e.g. "open files", "link" or "embed". Eventually specialized 
drag targets must register themselves, for e.g. accepting files or 
embedding objects, in addition do DockSite registration.

DoDi





More information about the Lazarus mailing list