in reply to A Drag and Drop (perl/Tk) question.
Should read:my $idx = $w->GetNearst($e->x, $e->y);
my $idx = $w->GetNearest($e->x, $e->y);
Your Drop function needs some changes as well. Instead of grabbing the x and y values through the properties of the directory tree, you should use the values that the Drop event sends through:
O'Reilly has a good Drag-and-Drop Primer available; you should check it out.sub Drop{ my ($lb, $dnd_source, $c_dest, $sel, $dest_x, $dest_y) = @_; my $group_item = $dnd_source->cget('-text'); my $nearest = $lb->GetNearest($dest_x, $dest_y); if (defined $nearest){ my $dir_item = $lb->entrycget($nearest, '-text'); print "*** $dir_item ***\n"; ### DEBUG: Show target value &AddGroupToDir($group_item, $dir_item); $lb->see($nearest); } }
-- grummerX
Update: Removed HTML tags in code. (stupid, stupid...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A Drag and Drop (perl/Tk) question.
by hiseldl (Priest) on Jul 29, 2002 at 18:09 UTC | |
|
Re: Re: A Drag and Drop (perl/Tk) question.
by blackadder (Hermit) on Jul 29, 2002 at 16:09 UTC |