Description: |
Hi all,
I recently needed the functionality of scrolling two
canvas widgets simultaneously, both of them embedded
in a ScrolledWindow widget. Of course there are
hundrends of references for doinh it in c.l.t., but not
easy to use code. So I decided it to write a BWidget
widget for doing exactly this.
The attched code is a first implementation of such a
widget. Of course name/options are open to
discussion :-)
The idea behind the new widget is simple: when a
new "MultipleScrollableWidgets" widget is created, only a
frame widget (without a border) is created. Then the
user is expected to create all the widgets that will be
scrolled as children of this frame. Also the user *must*
pack/place/grid the children onto the frame, in any way
he wants (i.e. like notebook pages).
Then, each child widget must be declared to the
MultipleScrollableWidgets widget with
method "addwidget". Only declared widgets will be
scrolled. Finally a ScrolledWindow can be created,
having the MultipleScrollableWidgets widget as
its "scrollable" widget.
The current implementation has also an option (-scroll)
to addwidget, for specifying whether each added widget
will scroll in the x & y direction. I.e, you can add two
canvases both of which will be scrolled in the x
direction, but only the second will be scrollable in the y
direction (i.e. because the first holds some header items
we want always visible...)
Any ideas are welcomed. Of course, the final target
should be to add such a widget in BWidgets :-)
|