Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Drag and drop in Mozilla

Author  Topic 

russellsoft

9 Posts

Posted - 2006-04-11 : 09:10:52
I need to realize drag and drop in Mozilla...
There is event ondragstart in Internet Explorer...
I need to handle such event in Mozilla...

I have table with some text. I need drag it in Mozilla and drop in other application...

How it can be realized???

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-11 : 10:36:17
Check this out... (works in Mozilla)

http://openrico.org/rico/demos.page?demo=rico_drag_and_drop_custom_draggable
Go to Top of Page

russellsoft

9 Posts

Posted - 2006-04-13 : 03:17:21
I did it myself... For example it can be looking like follow:


<html>
<head>
</head>
<body>

<a href="#" onmousedown='TryDragStart()' onmousemove='DragStart()'>
<table>
<tr>
<td>Row1</td>
<td>Row2</td>
</tr>
</table>
</a>

</body>
</html>


<script language="javascript">

document.onmouseup = DragStop;

var dragTried = false;

function TryDragStart()
{
dragTried = true;
}

function DragStop()
{
dragTried = false;
}

function DragStart()
{
if (dragTried)
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable)
trans.addDataFlavor("text/unicode");

var textData = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
textData.data = "Done!!!";

trans.setTransferData("text/unicode", textData, textData.data.length * 2);

var transArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
transArray.AppendElement(trans);

dragService.invokeDragSession(dragService.TEXT_NODE, transArray, null, dragService.DRAGDROP_ACTION_COPY);
}
}

</script>
Go to Top of Page
   

- Advertisement -