my $drag_obj = 0;
####
sub hover_over_drop {
my ($label_obj, $b_entry, $x_pos) = @_;
$label_obj->configure(-bg => $b_entry == 1 ? 'gray' : 'lightgray');
if ($b_entry) {
if (!$drag_obj) {
print "First time: ";
$drag_obj = $label_obj;
} else {
print " Next time: ";
}
printf "Dragging(%s) Callback for(%s)\n",
$drag_obj->cget(-text),
$label_obj->cget(-text);
}
}
####
sub perform_drop {
my ($drop_site, $x_pos, $drop_obj) = @_;
$drag_obj or die "Whoops -- \$drag_obj undefined (shouldn't happen!)\n";
printf "Drop label: %s\n", $drag_obj->cget(-text);
$drag_obj = 0;
}
####
More information can be found in the DragDrop directory in the source distribution of Perl/Tk. There are some sample scripts: local_test, motion_test and site_test. And if there are still open questions: use the force, read the source!