in reply to Re: Perl/Tk remote drag-and-drop
in thread Perl/Tk remote drag-and-drop
A few years late, but I'll record my findings here as I could not find the complete answer anywhere else (and trial and error has been kind to me).
First, to get a DropSite to accept drops, you have to provide a list of -droptypes for it to accept. This will also cause Perl to load the Tk::DragDrop::*Site/Drop modules as needed.
$sun->DropSite( -droptypes => ['KDE','XDND','Sun'], ... );
To get the data from the drop, use SelectionGet and set the selection type. The selection type is passed as the first argument to the -dropcommand.
$sun->DropSite( -droptypes => ['KDE','XDND','Sun'], -dropcommand => sub { $data = $sun->SelectionGet(-selection => $_[0]); } }
|
|---|