| Robert Heller 2005-07-30, 5:01 pm |
| "nicolas" <sl1200mk2@gmail.com>,
In a message on 30 Jul 2005 06:42:05 -0700, wrote :
"> i've tried to pack the scale in a canvas with a scrollbar, and the
"> strange behaviour appears.
">
"> if there is no scrollbar, the behaviour is normal.
">
"> so it's not a notebook problem.
"> does anybody know why this appear.....
If you want to use a canvas as a 'scrolling' window, you don't *pack*
(or grid or place) windows in it. Instead you create a window item:
canvas .c
scale .c.s
..c create window 0 0 -window .c.s
Then, you need to update the scrollregion of the canvas:
..c configure -scrollregion [.c bbox all]
It is also possible to 'layer' things using a frame widget -- more
complicated to set up, but easier once set up:
canvas .c
frame .c.f
..c create window 0 0 -window .c.f
bind .c.f <Configure> {ConfigureScrollwindow %W %h %w}
proc ConfigureScrollwindow {frame height width} {
set canvas [winfo parent $frame]
$canvas configure -scrollregion [$canvas bbox all]
}
scale .c.f.s
pack .c.f.s
(I *think* this will work -- I've not tested it.)
OR you can use the tixScrolledWindow widget, which uses a frame, but
does its own geometry management to handle the scrollbars.
">
">
\/
Robert Heller ||InterNet: heller@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || heller@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153
|