Next: Tabular Listbox and Up: The Family of Previous: The Scrolled Listbox

 

Other Scrolled Widgets 

The TixScrolledText widget is very similar to the TixScrolledListBox widget, except it scrolls a text subwidget, which is called text. One problem with the TixScrolledText widget, though, is its -scrollbar option doesn't work in the auto mode. This is due to a bug in Tk which doesn't report the width of the text subwidget correctly. Until this bug is fixed in TK, the auto mode will behave the same way as the both mode for the TixScrolledText widget.

Another scrolled-widget is TixScrolledWindow. Sometimes you have a large number of widgets that can't possibly be shown in the screen all at once and your application doesn't allow you to divide the widgets into several pages of a TixNoteBook. In this case you can use TixScrolledWindow. It contains a frame subwidget called window. You can just create as many widgets as you need as children of the window subwidget. An example is shown in program 2-9, which uses the TixScrolledWindow widget to implement a ``cheap'' spreadsheet application. The boxes of the spreadsheet are just entry widgets and they are packed inside the window subwidget. The user will be able to scroll to different parts of the spreadsheet if it is too large to fit in one screen.

tixScrolledWindow .sw -scrollbar auto
set f [.sw subwidget window]

for {set x 0} {$x $<$ 10} {incr x} {
frame $f.f$x
pack $f.f$x -side top -expand yes -fill both
for {set y 0} {$y $<$ 10} {incr y} {
entry $f.f$x.e$y -width 10
pack $f.f$x.e$y -side left -fill x
}
}

pack .sw -side left -expand yes -fill both

(Figure 2-9) Cheap Spreadsheet Application with TixScrolledWindow 

There are two more scrolled-widgets in the Tix library: TixScrolledTList scrolls a TixTList widget and TixScrolledHList scrolls a TixHList widget. The subwidgets that they scroll are called tlist and hlist, respectively. The use of the TList and HList widgets will be described in the next chapters.


http://tix.sourceforge.net