> From: Kevin Walzer [mailto:[email protected]]
> The solution was so simple and elegant it astounded me:
>
> Tkx::tclAE__installEventHandler ("Perl", "hihi", \&hello);
>
> In other words, pass the reference to the subroutine, just like a command
> callback, and the Tkx bridge takes care of mapping it internally to a Tcl
> command and then returning the correct output first to the app, then to the
> calling AppleScript.
>
> Amazing. I've been beating my head against a wall for a week trying to get
> this to work at the C level, without results. This opens up all kinds of
> things
> for my projects--thank you so much for the terrific work!
Hi Kevin,
Sorry for not replying earlier, when you haven't figured out the solution yet.
I want to add, that - while you've found correct solution, there is some more
TIMTOWTDI that I regularly use.
For a long time already I more heavily use just Tcl module, with only minimal
addition of higher-level modules (like Tkx or Tcl::Tk in my case)
You can just do
$int->Eval('.....'); # include any multiline code here to create widgets or
whatever
And then
$int->call('cmd', 'arg1', 'etc'); # for tcl/tk commands
$int->icall('.widget.some.thing', 'widgetmeth', 'etc'); # for tcl/tk commands
that do not involve perl references
$int->icall('.widget.some.thing', '-command', 'puts hello'}); # ... do not
involve perl references
$int->call('.widget.some.thing', '-command', sub{print 'hello'}); # here sub {}
- binded to tcl/tk counterpart
'icall' faster than 'call' and it does not do any perl reference to tcl binding.
While I am using Tcl::Tk instead of Tkx - both are on top of same Tcl module,
just different syntax - the same apply.
Regards,
Vadim.