Thanks!
Marcos.
see http://www.xulplanet.com/tutorials/mozsdk/dragdrop.php (and the
related ones). It works for trees too.
--
Mariano
Thanks a lot Mariano!
But where should I put the "ondraggesture" property, or how I can do
something like:
<button label="Drag Me"
ondraggesture="nsDragAndDrop.startDrag(event,buttonObserver);
with the treeitems if I don't have them?
I am using a Custom Tree View (implementing the nsITreeView interface).
I can drag XULElements from outside the tree (for example, the text in
a textbox) to the tree, but I can't find a way to drag the treeitems
that I have inside the tree.
I have somthing like this:
var TreeView = new Class({
initialize: function(table){
/* 'table' is a simple Array containing the data of the tree.
*
* table[r] points to the 'r' row of the tree
* table[r][c] points to the cell at 'r' row and 'c' column.
*/
this.table = table;
this.rowCount = table.length;
},
getCellText: function(row, col) {
return this.table[row][col.id];
},
getCellValue: function(row, col) {
return this.table[row][col.id];
},
....
and another class like:
var TreeWidget = new Class({
tree: null,
data: [],
initialize: function(tree){
this.tree = tree;
...
},
addItem: function(item){
this.data.push(item);
},
update: function(){
this.tree.view = new TreeView(this.data);
},
...
Thanks!
Marcos.
You put the event handler on <treechildren> or <tree>. When the event
arrives, you can use nsITreeBoxObject::getCellAt to figure out which
item the user is dragging, or you can just assume the user is dragging
whichever items are currently selected (the latter makes more sense if
you support multiple selection).
Igor Tandetnik
Hi,
you could have a look here :
http://www.novatice.org/xul/demo.php#ancNovatree
--
Cordially,
Christophe Charron
http://xsoftware.fr