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'.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.