
I would have neither thought, that using #PB_Drop_Text and EventDropText() can be used for handling the dragging of images from a website!

That's definitively something, which should be stated in the PB docs I thinks. Else anyone would think, that using #PB_Drop_Image and EventDropImage() is the way to go (which is probably the right thing, when doing drag & drop of images between gadgets inside of the same application). Or?
Anyway it's not so simple as I thought...

When I tried to implement your 'simple' solution in my application (which is also able to handle dropped images from harddisk, using #PB_Drop_Files and EventDropFiles()) all dragged images from a website will also be handled as files instead of text. Resulting in returning the filepath in the tempory internet folder for the dragged image from a website (e.g. "C:\Users\Andre\AppData\Local\Microsoft\Windows\INetCache\IE\PZYEYX5E\logopb[1].gif", instead of giving its original html address (e.g. "http://www.purebasic.com/images/logopb.gif").
Your extended example should illustrate this. The part for handling 'text' will neither be executed, so EventDropFiles() is always returning a path from disk.
Code: Select all
LoadFont(0, "Georgia", 12)
If OpenWindow(0, 0, 0, 800, 600, "Drag with image!", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
WebGadget(0, 10, 10, 300, 580, "http://www.purebasic.com")
EditorGadget(1, 320, 10, 300, 580)
SetGadgetFont(1, FontID(0))
AddGadgetItem(1, -1, "Drop here V :"+#CRLF$)
WebGadget(2, 620, 20, 160, 580, "")
EnableGadgetDrop(1, #PB_Drop_Text, #PB_Drag_Copy) ; needed for dragging images from a website
EnableGadgetDrop(1, #PB_Drop_Files, #PB_Drag_Copy) ; needed for dragging image from desktop / harddisk
Repeat
eventID = WaitWindowEvent()
Select eventID
Case #PB_Event_GadgetDrop
If EventGadget() = 1
If EventDropType() = #PB_Drop_Text
AddGadgetItem(1, -1, EventDropText())
SetGadgetText(2, EventDropText())
ElseIf EventDropType() = #PB_Drop_Files
AddGadgetItem(1, -1, EventDropFiles())
SetGadgetText(2, EventDropFiles())
EndIf
EndIf
EndSelect
Until eventID = #PB_Event_CloseWindow
EndIf
Currently I'm at the same point as before. My original question was only about getting the html address of dragged images (which I thought was the only problem, as dragging images from disk was already working), but now it must be extended to "How can I retrieve the html address of a dragged image from website, when also dragging of images from disk (and retrieving their file path) should be possible?"
