(Trying to send this to the list again for reference and to see if I can send emails now. It didn’t go through the first time because GMX had been blocked by perl.org <http://perl.org/>)
> On Sep 21, 2018, at 6:01 AM, welle Ozean via tcltk <tcltk@perl.org > <mailto:tcltk@perl.org>> wrote: > > Using Tcl::pTk I am trying to implement Drag&Drop on macOS without success. > According to its documentation, Tcl::pTk should support it. This is what I am > trying now (slightly adapted from my version for Windows and Perl/Tk): > > $MyWidget->DropSite(-dropcommand => [\&accept_drop, $tap], -droptypes => > (['Local', 'tkdnd'])); > > sub accept_drop { > my ($tab) = @_; > my $filePath; > eval { > if ($^O eq 'MSWin32') { > $filePath = $tab->SelectionGet(-selection => $selection, > 'STRING'); > } > else { > $filePath = $tab->SelectionGet(-selection => $selection, > 'FILE_NAME'); > } > } > #DO THINGS with $filePath > } > > I have downloaded a binary of tkdnd (libtkdnd2.8.dylib). How do I let > Tcl::pTk know of this library? Or there is any way to implement it without > adding new libraries (I am using the Tcl shipped with macOS). > > Thanks > Welle Hi Welle, As Vadim stated, neither Tcl::pTk nor Tcl.pm do much to be aware of Tcl/Tk modules; Tcl::pTk currently only looks for a few that are required (Tklib, Tix, TkTable) or have Perl-wrapper syntax for (BLTNotebook). Ideally, tkdnd should be installed where `package require` is all that’s needed to use it; I don’t know my way around the other `package ifneeded` or other commands that might be needed if Tcl/Tk needs to manually be told where it is. There is at least one undocumented subroutine in Tcl::pTk that might be useful, `$MW->interp->pkg_require()`, however I do not know what its advantages or limitations are over just using `$MW->interp->Eval("package require tkdnd”)`. Though this step might be done automatically by Tcl::pTk depending on the syntax used. Someone recently added tkdnd to MacPorts, so I might give it a try soon. I wonder if tkdnd support might be something to include in Tcl::pTk, similar to what’s done for TkTable and other Tk extensions. Also, be aware that there have been some recent changes since tkdnd 2.8 was released which address issues on macOS; https://github.com/petasis/tkdnd/commits/master <https://github.com/petasis/tkdnd/commits/master> Christopher A. Chavez