[Lazarus] Generalized DragDrop

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Jan 22 19:41:05 CET 2011


On 22 January 2011 17:04, Michael Van Canneyt <michael@***> wrote:
>
>
> On Sat, 22 Jan 2011, Hans-Peter Diettrich wrote:
>
>> 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.
>
> While it is correct that Graeme did this, I still have not seen in action.
> i.e. I have used the application-specific DnD, but I wouldn't know how to
> handle the intra-app DnD.

That's the beauty of that design.... internal component-to-component
or external app-to-app DND is handled exactly the same - from the
developers perspective. That was the whole point of that
implementation - so you application is single source, no matter the
platform (and importantly, no IFDEF's). Internally the fpGUI frame can
optimize for internal component-to-component DND without needing to
speak to the OS or window manager.

I have also note that the fpGUI DND implementation is not 100%
complete yet. Currently I still need to implement the non-text data
transmission. Not hard to implement, because the internal workings are
already implement in fpGUI. I just need to find some time, to complete
the alternative data types handling.

>> - 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.
>
> I'm all for it. Although I'm not sure that this can be implemented in a
> cross-platform way.

I not sure if I understand the original statement, but in fpGUI I use
the mime types to register the data that must be transfered via DND.
Under Windows, I also register common mime-types that have easy
mappings to Windows weird CF_xxx types. So if you register
'text/plain' data in fpGUI, then under Windows, it will also register
CF_TEXT for example.


> On Windows, the intra-app drag/drop is handled using OLE/DDE. On Linux,
> there is no such thing, and I think it depends on the used desktop software
> (KDE vs Gnome).

Correct, under Windows I use OLE DND, and under Linux I use the XDND
protocol which uses mime-types. The XDND protocol has support for any
data types that you can describe with mime.


> I don't know how it is done in Mac.

I have to clue about Mac either. :)


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net




More information about the Lazarus mailing list