how to use scrollbars for canvas
Posted by vinzy1983 (vinzy1983), 10 December 2004hi,
i want to use scrollbar for a canvas.
can someone please tell me how to do this
Posted by admin (Graham Ellis), 11 December 2004Create a frame, and grid a canvas and two scrollbars within it.
Define the visible size of the canvas via -width and -height, and the overall size with the -scrollregion.
Tie the two scrollbar's events to the canvas using the -xscrollcommand and -yscrollcommand on the canvas.
Set the highlight thickness and border widths to 0 in order to avoid them occupying any of the visible canvas area.
Posted by vinzy1983 (vinzy1983), 13 December 2004could u pls provide me any examples for doing that..
because i am facing problems while providing the options for canvas.
do i need to use the grid command fro placing the canvas and scrollbar on the frame..
Posted by admin (Graham Ellis), 13 December 2004I don't have an example that's within my copyright to reproduce here, but there is a good example in "Practical Programming in Tcl and Tk" (see http://www.wellho.net/book/0-13-022028-0.html) on page 474. The best example I could find online (I've just had a quick search - I'm sure there are more) is at http://www.usenix.org/publications/login/2002-06/pdfs/flynt.pdf
And, yes, you place the scollbar and canvas on the frame with the grid command.
Posted by vinzy1983 (vinzy1983), 13 December 2004don'y mind, but, now could you please tell me how grid them together in a canvas.
because i haven't used grid command in tk till now..
but i have an urgency to complete my work .
so would be a great favour from your side if u could please help me in this topic.
THANKS IN ADVANCE
Posted by admin (Graham Ellis), 13 December 2004I'm just about to leave home to give a training course, so much as I would like to do you the great favour, I can't at the moment. The two references in my previous answer both include worked examples, including the use of grid. One of the references is online and available for you to read.
A previous answer at http://www.wellho.net/forum/Assistance/Answers-on-Opentalk.html may also help give you some further insite into what I we can provide here, and the timescale put on answering.
Posted by vinzy1983 (vinzy1983), 13 December 2004it's ok thank you.
i got it solved without using grid..
thank you once again..
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho