Is it possible to drag and drop a web browser URL into a Lazarus app?
Are there some controls with that facility?

Mailing lists / lazarus / 2012-03
7 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Is it possible to drag and drop a web browser URL into a Lazarus app?
Are there some controls with that facility?
Frank Church wroteIs it possible to drag and drop a web browser URL into a Lazarus app? Are there some controls with that facility?
In fpGUI is is handled just like any other DND action. Simply register what mime-type the drop target must look out for. It will then happile accept a drop action if such a mime-type is supplied. Simple and easy to use, and works on all platforms.
Lazarus's drag-n-drop is based on the very limited Delphi / Windows DND, so is mainly build for in-app drag-n-drop, and not able to accept external drag-n-drop actions. Normally (in Delphi) you would have to revert to Windows API calls to get better DND support. I remember seeing them (the Lazarus team) extending the default limited DND a bit to support dropping files on a LCL app, but that is a far cry from complete DND support.
Out of interest, I ran the DND Demo of fpGUI, which shows what mime-types the source of a DND action is willing to supply. I dragged the URL from the Chrome web browser and dropped in onto the Text Edit field. Below that is the complete list of mime-types (8 in total) that Chrome was willing to supply the data in. I don't know if this information will help you with your LCL application in any way.
Inter-process D&D requires special assistance by the OS. IMO such operations are limited to drop file names, or other pure text, unless a platform offers something like OLE-DragDrop.
DoDi
Hans-Peter Diettrich wroteInter-process D&D requires special assistance by the OS. IMO such operations are limited to drop file names, or other pure text, unless a platform offers something like OLE-DragDrop.
That shouldn't be a problem for Lazarus LCL then, seeing that "everything is native" and all Lazarus's target desktop platforms support inter-process DND - yet the full inter-process DND support in LCL is still missing. Will this be fixed before the 1.0 release?
Most OS's these days can and do use mime-types (just like the whole internet does) for DND. But obviously each OS/platform has a different way in which they transfer data between processes (I guess this is what you meant by "like OLE-DragDrop"). Anyway, fpGUI uses mime-types for DND, for in-app and cross-process DND. Under Windows, I still have support for the older-style DND (eg: where data types are registered as STRING or WIDESTRING like the clipboard etc). In the case of fpGUI under Windows, I simply map those older data types to similar mime-types automatically. X11 uses mime-types as-is (so no mapping or trickery required under X11). Mac OS X also has mime-type DND support. What's nice about X11's DND support is that no data is generated or transferred until it is actually known that the drop target accepted the drop. Windows unfortunately is not that clever and generates the data resources when the DND action starts at the source, not when the drop target accepts the drop. So Windows is a bit waist-full with resources (what's new).
Feel free to file an feature request.
You obviously don't understand OLE-DragDrop :-(
DoDi
In fpGUI is is handled just like any other DND action. Simply register what mime-type the…
2012/3/22 Graeme Geldenhuys :
fpGUI is something I should be trying out more. I have remember that Lazarus doesn't always mean LCL :)
Your example fits my need perfectly.
Feel free to file an feature request. You obviously don't understand OLE-DragDrop :-( DoDi
Hans-Peter Diettrich wroteFeel free to file an feature request.
A patch would be much more useful.