>
> Is there a workaround for this? The only thing I can think of is to delete
> the DropSite definition when a page is lowered, and only have one dropsite
> active at a time. The other workaround would be for me to implement my own
> crude drag'n'drop, but I'd rather not at this time :)
>
> --Ala
>
OK Tried DTF and it behaves the same as you describe (always drops to
Page 1). Then looked at my D&D app and discovered I always
keep the key of the "current" raised page handy and apply it when the drop
event occurs, so I've made a similar update to your code:
use strict;
use Tk;
use Tk::DragDrop;
use Tk::DropSite;
use Tk::NoteBook;
my $mw = new MainWindow;
my $lb = $mw->Listbox->pack(qw/-side left -fill y/);
my $nb = $mw->NoteBook->pack(qw/side left -fill both -expand 1/);
my $p1 = $nb->add('page1', -label => 'Page 1');
my $p2 = $nb->add('page2', -label => 'Page 2');
my $l1 = $p1->Listbox->pack(qw/-fill both -expand 1/);
my $l2 = $p2->Listbox->pack(qw/-fill both -expand 1/);
$lb->insert(end => "Line $_") for 1 .. 10;
my $dnd = $lb->DragDrop(-sitetypes => [qw/Local/],
-event => '<B1-Motion>',
);
#
# DAA new code
#
my %pages = ('page1', $l1, 'page2', $l2);
$pages{$_}->DropSite(
-droptypes => [qw/Local/],
-dropcommand =>
sub {
$pages{$nb->raised()}->insert(end => $_)
for map $lb->get($_), $lb->curselection;
})
foreach keys %pages;
MainLoop;
HTH,
Dean Arnold
Presicient Corp.
www.presicient.com
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@xxxxxxxxxxxxxxxxxx
|