RE: Drag and Drop in Tkx

[email protected] ("Konovalov, Vadim (Vadim)** CTR **")
Newsgroups perl.tcltk
Message-ID <35BF8D9716175C43BB9D67CA60CC345E1242F70C@FRMRSSXCHMBSC2.dc-m.alcatel-lucent.com>
> From: Laurence Anthony [mailto:[email protected]] 
> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.