Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Window dragdrop event not fired

26 views
Skip to first unread message

Emmanuel Engelhart

unread,
Oct 29, 2012, 9:15:25 AM10/29/12
to dev-te...@lists.mozilla.org
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

Christian Pernot

unread,
Oct 30, 2012, 4:22:41 AM10/30/12
to
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

Emmanuel Engelhart

unread,
Nov 12, 2012, 7:21:02 AM11/12/12
to Christian Pernot, dev-te...@lists.mozilla.org
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
> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul

0 new messages