Re: Drag-n-Drop in Perl/Tkx

[email protected] (Laurence Anthony)
Newsgroups perl.tcltk
Message-ID <[email protected]>
Thank you so much, Vadim!

I have taken your script and complied it into a standalone executable with
PerlApp. Everything worked here smoothly.
Getting PerlApp to see the tkdnd required the Tkx::lappend hack that you
discussed a while back. I'm sure there is a better way to do this.
If you have any suggestions, please let me know.

Below are my comments.
Regards,
Laurence.

#Comments
#Get tkdnd from http://sourceforge.net/projects/tkdnd/files/ (I used the
Windows binary)
#Put tkdnd2.0 into C:\Tcl\lib
#Note 1 on where to put tkdnd:
http://www.mail-archive.com/[email protected]/msg00448.html
#Write the script and add some lines to help PerlApp find the tkdnd package
#Note 2 on helping PerlApp to find tkdnd with Tkx::lappend:
http://www.nntp.perl.org/group/perl.tcltk/2008/11/msg187.html
#

use strict;
use Tkx;
Tkx::lappend('::auto_path', 'C:/Tcl/lib/');
Tkx::lappend('::auto_path', 'C:/Tcl/lib/teapot/package/win32-ix86/lib');
Tkx::lappend('::auto_path', 'C:/Tcl/lib/teapot/package/tcl/lib');



Tkx::package_require('tkdnd');

my $e;
my @e;
my $mw = Tkx::widget->new(".");
my $w_edit = $mw->new_entry(-name=>".current_dir",-textvariable=>\$e);
$w_edit->g_pack(qw '-fill both -expand true');

Tkx::tkdnd__drop___target_register($w_edit,'*');
Tkx::bind ($w_edit, '<<Drop:DND_Files>>', [ sub {
      $e = shift;
      print "I have '$e'\n";
}, Tkx::Ev("%D")]);

Tkx::MainLoop;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.