Re: Window dragdrop event not fired

Emmanuel Engelhart <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Current documentation was not so helpful because in my case because the
given example simply did not work:
https://developer.mozilla.org/en-US/docs/DragDrop/Recommended_Drag_Types#file

The way I have achieved to make it working:

xul (in the <window> tag):
ondragenter="return startDragOnWindows(event)"
ondragover="return startDragOnWindows(event)"
ondrop="return dropOnWindows(event)"

js:
function startDragOnWindows(event) {
    return event.dataTransfer.types.contains("text/html");
}
function dropOnWindows(aEvent) {
...
}

So I had to force the flavor as "text/html" to get a drop event
triggered on all XUL elements.

Emmanuel

Le 30/10/2012 09:22, Christian Pernot a écrit :
> Hello,
> 
> maybe you should have a look at a mor up-to-date documentation :
> https://developer.mozilla.org/en-US/docs/DragDrop/Drag_and_Drop
> :)
> 
> Regards,
> Christian
> 
> Le 29/10/2012 14:15, Emmanuel Engelhart a écrit :
>> Hi,
>>
>> I have a xulrunner app. and want to open file by drag&drop from the file
>> explorer. This was working with 1.9.2 but it does not anymore using
>> XR14. I guess the HTML5 implementation is the rootcause, so I want now
>> to implement it in the new/right way... But until now I fail.
>>
>> It seems that the "window" DOM element does not get the "dragdrop" event
>> trigger:
>> https://developer.mozilla.org/en-US/docs/DOM/window.ondragdrop
>>
>> I have a xul window with those attributes:
>> ondragdrop="dump('ondragdrop\n')"
>> ondragleave="dump('ondragleave\n')"
>> ondragenter="dump('ondragenter\n')"
>> ondragover="dump('ondragover\n')"
>>
>> All events are triggered by moving from my desktop a file to my
>> application window... except the "dragdrop" one. By releasing the mouse
>> left button, I get in place a "dragleave" event triggered.
>>
>> Is that a bug or do I misunderstand something?
>>
>> Regards
>> Emmanuel
>>
> 
> _______________________________________________
> dev-tech-xul mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-xul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.