logo       

Re: More Drag/Drop Problems: msg#00103

Subject: Re: More Drag/Drop Problems
> 
> 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



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe