I made a few mods to get this working on Win32.
On my machine, the use statement required me to specify Win32, there might be some other incantation required on Linux? I also added -text so I could see something to drop onto. Then I took out the -droptypes. There appears to be something wrong with that.
So, the below does work on my Win32 box. Hopefully this will provide a few clues for your Linux problem.
#!/usr/bin/perl
use strict;
use Tk;
use Tk::DropSite qw(Win32);
my $mw = new MainWindow(-width => 500, -height => 300);
my $label = $mw->Label(-text => "this is test")->pack->place(-relwidth
+ => 1.0, -relheight => 1.0);
#$label->DropSite(-droptypes => ['XDND'], -dropcommand => [\&dropFile,
+ $label]);
$label->DropSite( -dropcommand => [\&dropFile, $label]);
MainLoop;
sub dropFile {
print "DROP\n";
}
Update: I am using Perl 5.22, Active State on Win XP. Tk and DropSite come in the standard dist, so I didn't have to install anything. Sorry I can't be of more help as I have no Linux to test on.
I did find this article
drag n drop primer. It says:
"Note: Perl/Tk supports Sun, XDND, KDE, and Win32 remote DND protocols". I suppose this is why I had to add
qw(Win32) to the use statement. Could be that what you need is "XDND"? Not sure, but an idea.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.