I'm converting Perl/Tk to Perl/Tkx and I'm struggling with getting Drag
and Drop to work in Perl/Tkx. I had found help for DND in Perl/Tk and
use in in a large script I wrote, but for simplicity, here is a simple
Perl/Tk script that supports DND:
use strict;
use Tk;
use Tk::Pane;
my $textVariable = "my text";
my $mw = MainWindow->new;
my $frame = $mw->Frame()->pack(-side => 'top', -expand => 1, -fill =>
'x');
$frame->Label(-text => "My Label",
-anchor => 'w',
-width => 10)->pack(-ipady => 1,
-side => 'left');
my $entry = $frame->Entry(-textvariable => \$textVariable,
-width => 40)->pack(-side => 'left');
$frame->DropSite(-dropcommand => [\&AcceptDrop, $frame],
-droptypes => ('Win32'));
MainLoop;
sub AcceptDrop
{
my ($widget, $selection) = @_;
my $filename;
$filename = $widget->SelectionGet(-selection => $selection,
'STRING');
$textVariable = $filename;
}
Is there an easy way to convert this simple script to use Tkx? I know
there was a post about this in the past, but I couldn't figure out
exactly what was meant. For example, in that post there was
$interp->packageRequire('tkdnd', '2.0');
But $interp wasn't initialized to anything.
I'm using perl, v5.8.8, binary build 822.
Thanks,
David