Hello!
I have a problem regarding PAR and Tk::DropSite. I've compiled the sample script shown below, but the executable won't run. I get no messages. The executable quits silently.
Have i missed something? Is there an issue regarding PAR and Tk::DropSite? Please help. I'm running WinXP SP2, ActiveState 5.8.6 build 811.
Best regards Ronny
-- Sample scipt:
#!/usr/bin/perl -w # file: dnd.pl ################# use Tk; use Tk::DropSite; use strict; use vars qw($mw $textbox);
################# sub accept_drop { my($widget, $selection) = @_;
my $string_dropped;
eval {
if ($^O eq 'MSWin32') {
$string_dropped =
$widget->SelectionGet(-selection => $selection,
'STRING');
} else {
$string_dropped =
$widget->SelectionGet(-selection => $selection,
# 'FILE_NAME');
'STRING');
}
};
if (defined $string_dropped) {
$widget->insert('end', $string_dropped . "\n");
}
}#################
sub print_string_and_exit {
my ($mw, $textbox, ) = @_; my $string;
$string = $textbox->get("0.0", "end");print STDOUT "You dragged and dropped ::\n$string\n";
$mw->destroy;
}
$mw = new MainWindow; $mw->title("Try to Drag and Drop");
$textbox =
$mw->Scrolled('Text', -scrollbars => "osoe",
-height => 10,
-width => 72,
)->pack;
$textbox->DropSite (-dropcommand => [\&accept_drop, $textbox], -droptypes => ($^O eq 'MSWin32' ? 'Win32' : ['XDND', 'Sun']) );
my $okay_button = $mw->Button( -text => "Okay", -command => [ \&print_string_and_exit, $mw, $textbox, ] )->pack( -side => 'left', -anchor => 'n', -ipadx => 10, -expand => 1, );
MainLoop;
