Courage, Thank you so very much for your help so far!
After a sanity break, I got my app up in Tcl::Tk in Perl/Tk compatability mode. I've been reading demos, docs, and articles. This is the Tcl/Tk code that I think I need to run (followed by my questions):
package require tkdnd
dnd bindsource .perl_hlist_object text/uri {\&Perl_Sub}
bind .perl_hlist_object <1> {dnd drag %W}
1) Do I need the interp object to setup DnD?
I can start a Tcl::Tk GUI in one of two ways:
my $mw = MainWindow->new; #Gives me the main window object, but not
+ the interpreter
my $interp = new Tcl::Tk; #Gives me the interpreter, but not the ma
+in window
Do I need both objects? I think I need the interp object to make DnD calls, and the main window object to use perl/Tk compatability mode syntax. Is there a way to get both objects? Should I rewrite the GUI in Tcl/Tk syntax?
2) Can I get a Tcl/Tk path from a perl widget object?
This is related to #1. I can get object for a Tcl/Tk path with: my $hlist = widget(".f03.hlist01"); However, I have the ojbect and I think I need the path to set up DnD.
3) How do I make the actual calls?
Here's my stab at the Tcl/Tk objects under Tcl::Tk in perl (I haven't tested this because of #1):
My $i = new Tcl::Tk;
(... generate GUI ...)
$i -> call("package require", "tkdnd");
$i -> call("dnd bindsource", ".perl_hlist_object", "text/uri", {\&Perl
+_Sub});
$i -> call("bind", ".perl_hlist_object", "<1>", {dnd drag %W};
Is this correct, are there any gotchas?
- Can I put a use a perl object instead of a Tcl/Tk path (i.e. $results_l instead of .f03.hlist01)?
- Is the script on line 4 expecting a Tcl sub, or can I call a perl sub? Is there a special syntax?
- I don't understand the reference to %W. It's "The window the event is delivered to", and it doesn't make sense to me in this context. Would I leave it %W, or do I need to provide a value?
I greatly appreciate any help in this. It feels like I'm close, but I don't know where to look for the 'last mile'. |