To answer your questions in very brief:
- indeed, you need interpreter to make any Tcl/Tk operations.
- at any time $widget->interp returns it
- at any time $widget->path returns widget path in the form .fr.t
stringification should also work so "$widget" should return path;
- Tcl::Tk and Tk widgets are very interchangeable, and here lies the extreme power of approach.
Say, you have existing GUI, you can write
$button=widget('.fr.b');
and then just use $button with perl/Tk syntax
- to make Tcl/Tk calls, you should go either of following ways:
- $interp->Eval('package require tkdnd');
- $interp->invoke('package', 'require', 'tkdnd');
- $interp->call('package', 'require', 'tkdnd');
1st one allows you to execute any Tcl/Tk code, 2nd is much faster than all of them because there is no parsing or substitution, 3rd one is most generic and most frequently used and it allows for you to directly use anonymous subroutines, scalar references and so on...
It could be a bit confusing that Tcl uses curly braces in a very different way compared to Perl (those are string delimeters w/o interpolation) but you do not need to go into Tcl syntax really deep.
What you wrote
$i -> call("dnd bindsource", ".perl_hlist_object", "text/uri", {\&Perl
+_Sub});
$i -> call("bind", ".perl_hlist_object", "<1>", {dnd drag %W};
should probably be
$i -> call("dnd", "bindsource", ".perl_hlist_object", "text/uri", \\'%
+W',sub{Perl_Sub(shift)});
$i -> call("bind", ".perl_hlist_object", "<1>", 'dnd drag %W');
%ev-variables processed differently in Tcl::Tk compared to perlTk so this '%W' could be a bit tricky, this is described in perl's Tcl module...
I can check for details later, so let me know on your further results.
Also use Tcl::Tk discussion list tcltk-perl at lists.sourceforge.net
addition 1 Please refer to documentation of Tcl.pm module using perldoc Tcl, or may be http://search.cpan.org/~vkon/Tcl-0.84/Tcl.pm, so there are plenty explanations of 'call', 'icall', 'invoke' methods
Best regards,
Courage, the Cowardly Dog