|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Re: Two questions regarding -tk-canvasby Sandy (Curate) |
| on Oct 18, 2006 at 15:49 UTC ( [id://579191]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
This is my solution for problem number 1.
First I created a callback for the scrolling action. This call back then gets the current canvas position (via the sub xview and yview), moves the canvas (again via xview and yview), and finally gets the new position of the canvas The return value of xview and yview is a percentage of the canvas that is not seen compared to the total scrollable area. So, it is just simple arithmetic to see how far the canvas actually scrolled. Finally, I just moved the rectangle the same amount the canvas moved. Modified Code: Cheers Sandy PS: Thanks, that was fun! UPDATE: If window is expanded and contracted such that the yellow box is no longer visible, then no amount of scrolling will make it visible again. Mmmm.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||