| Description: |
A drag to a tree widget does not work, if the
destination tree doesn't have any nodes.
This script illustrates the problem:
package require BWidget
proc dropcmd {dest source dropInfo operation dataType
data} {
set sourceTree [winfo parent $source]
$dest insert end root $data \
-text [$sourceTree itemcget $data -text]
$sourceTree delete $data
}
set t1 [Tree .t1 -dragenabled 1]
$t1 insert end root aNode -text "A sample Node"
set t2 [Tree .t2 -dropenabled 1 \
-dropovermode w \
-dropcmd dropcmd]
# If the destination tree has at least one node,
everything works
# $t2 insert end root anotherNode -text "Another node"
pack $t1 $t2 -side left
If the destination tree doesn't have a node, the
dropcmd will not be called. As far, as I've debugged
the problem, the reason, that the dropcmd isn't called,
is in Tree::_drop_cmd:
if {[llength $data(dnd,node)]
&& [llength [set cmd [Widget::getoption $path
-dropcmd]]]} {
return [uplevel \#0 $cmd \
[list $path $source $data(dnd,node)
$op $type $dnddata]]
}
If the destination tree doesn't have a node,
$data(dnd,node) is empty (but should be "widget", as
far, as I can tell)
|