> From: Laurence Anthony [mailto:anthony0...@gmail.com] > The next thing to do would be to convert the Tkdnd script > that Vadim sent > earlier into Tkx syntax: > > #the line below is just creating a widget - no "dnd" consideration > pack [entry .frTop1.current_dir -textvariable > ptclv_current_dir] -side left > -fill x -expand 1 > # and this actually makes DND work > tkdnd::drop_target register .frTop1.current_dir * > bind .frTop1.current_dir <<Drop:DND_Files>> { > set ptclv_current_dir [lindex %D 0] > ptcl_refresh > }
IMHO this part of code should be left in plain tcl, but a Tkx method should be created, which will take a widget and a subroutine ref, which will be invoked for DND operation, maybe in a separate package. Tkx::Tkdnd, which also invokes "package require tkdnd" at a proper time. I vote for a bit more pure-tcl/tk eval code in Tkx, but maybe you're right, and exactly opposite POV takes place, which is also perfectly okay with me :) TIMTOWTDI > > Here, I'm not familiar with the <<Drop:DND_Files>> code, but > the rest is > probably OK (although I worry about the syntax for the set command > set ptclv_current_dir [lindex %D 0] > > I feel a complete novice here even though I've written > several large Tkx > apps. I worry that others (especially coming from PerlTk) > will be completely > lost. I've shared the Tcl::Tk version of code for this snippet, which could make PerlTk people think that they see a familiar code, but actually this isn't absolutely so :) Regards, Vadim.