![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Re^2: perl Tk::Scrolled : how do I hijack existing subwidget bindings?by Rudif (Hermit) |
on Apr 03, 2005 at 22:48 UTC ( #444550=note: print w/replies, xml ) | Need Help?? |
Hi zentara, it's me again. I experimented with sub scrollcallback{...} as you suggested, and indeed it provides a solution for my problem : to keep the existing behavior of the Text widget when the user drags or clicks on the scrollbar's elements, and to extend this behavior with actions that I specify (adding text to the Text widget, perhaps fetching it from a file). Now this part works, and I realize that there are two pairs of bindings on the Text widget itself that I want to extend in similar way. (1) when the user presses repeatedly the up (down) arrow and the cursor hits the top (bottom) of the Text window, this causes Text to scroll up (down). When there is no more text to scroll to, I want to add some more from an external source (a file), just as if the user was clicking on the Scrollbar's arrows. (2) I want to add similar behavior for the mouse wheel rotation which normally also scrolls the text (on Win32). I looked into Tk docs, tutorials and examples, but so far I failed to puzzle it out: should I use bind? bindtags? configure? - I'm lost again. Another succint example from you (or anyone else) would take me closer to the goal.
I was about to post above plea, out of laziness (the wrong kind), but I thought again. Another plea? This time my hubris would not let me, and I went on to search and experiment some more. Couple of hours later, here is the demo that shows all three behaviors that I was after. To test it, just try to scroll the text in every possible way and watch the effect.
Thank you again for the help.
In Section
Seekers of Perl Wisdom
|
|