[Lazarus] Generalized DragDrop

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Jan 24 09:23:09 CET 2011


Op 2011-01-23 22:09, Hans-Peter Diettrich het geskryf:
> Either different applications have to agree about
> exchangable data formats,

What's wrong with that? That is exactly what *all* DND implementation
do! The Source of the DND action supplies a list of data types they
support, the target goes through the list and if they don't understand
any of the data types then DND (data exchange) cannot happen.

Dragging selected text from Wordpad to Notepad (on my Win2000 system) is
not possible (yet dragging a text file is). So clearly Notepad limits
what it will accept, looking for a very specific data format, and not
even supporting CF_TEXT data.


> or a single application needs only private
> types, for strictly private use.

correct again. If I want to limit what data my apps or components must
accept, then I'll add some application specific mime-type which only my
other apps will probably support. This is pretty normal DND
functionality on any platform.

Saying that, most apps at least allow some form of "plain text" data too
- as a fallback. But that is not a giving rule in DND. Se my earlier
paragraph of Notepad.


> Every data type must be associated with a class (or component),

It's not possible between applications. Why would WordPad know what a
TMemo or TEdit is? So you MUST supply the data in some byte array (this
depends on the platform), or simply supply the URI in case of a file(s),
so the target can read that file directly if they wanted.



> Did you realize that URI lists are meaningful only to applications, that
> can handle the referenced resources - in their specific data format,
> that is not part of the URI. Otherwise the only use of such information
> is textual display of the URIs themselves, that does not require any
> special conversion.

I'm not sure I understand the point your are trying to make. I can say
that 'text/uri-list' could simply be a "fallback" data type. Normally
the source of DND has a list of data formats, and normally they are in
"most specific" to "least specific" order. Take Gnome's Nautilus (file
manager) as an example. It supplies 8 data formats when dragging files.
The first being something I guess only Gnome applications will
understand. Then the format list becomes less and less specific,
'text/uri-list' being the second choice of data types.

See attached screenshot.


> Okay, Firefox works - but why then do you not simply show the CF_TEXT or
> CF_UNICODETEXT format?

It does. See the 'firefox_dnd.png' attachment. And as you can see, it is
also not the "preferred" format for Firefox, as CF_TEXT is listed number
6 only.



Regards,
  - Graeme -

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nautilus_dnd.png
Type: image/png
Size: 4527 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110124/dd5d5e41/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firefox_dnd.png
Type: image/png
Size: 1964 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110124/dd5d5e41/attachment-0007.png>


More information about the Lazarus mailing list