go ahead... be a heretic | |
PerlMonks |
Tkx - bind - append bindingby kcott (Archbishop) |
on Jun 23, 2017 at 20:23 UTC ( [id://1193404]=perlmeditation: print w/replies, xml ) | Need Help?? |
I'm currently working on a module which uses Tkx. I came across something tricky involving appending bindings. It took a while to work out and, in the process, I ran a lot of tests: the results were quite surprising. I've posted this here in case anyone else finds themselves in a similar position: hopefully, it might save them some time and effort. Tkx is a thin wrapper around Tcl. Its documentation is minimal: it just links to the Tcl documentation and leaves you to work out how to use it. In this instance, I was looking at the bind command documentation for information on appending a binding. I've linked to all of it, here's the relevant parts for this specific post:
That's all it says about appending bindings. I investigated this; ran some tests; and was somewhat surprised at the outcome. The module I'm currently working on now contains this documentation:
The surprising part was all the different ways of concatenating a string ('+') with an anonymous coderef, a named coderef, and an anonymous arrayref, without the code blowing up in my face. This may also be useful to those using related modules, like Tcl::Tk and Tcl::pTk; although, I could be completely wrong on that (I have little knowledge of these beyond knowing of their existence). Update: Despite successfully running two dozen or so tests on all those syntax formats, none of them appear to be actually functional. My apologies to anyone who's been trying to get them to work. I've spent a bit of time looking into this. I can append one binding using either
or
And that works for CODEREF as any of these three:
However, whenever I attempt to append a second (or third) binding, none of the appended bindings work; although, the original binding works as expected. The only feedback I get looks like the following (there's no line numbers or other useful information):
So again, my apologies to anyone who rushed off to try what I originally posted. I will spend some more time on this: I'll let you know if that proves fruitful. — Ken
Back to
Meditations
|
|