Purpose: http://tcllib.sourceforge.net/BWman/ScrolledWindow.html is the documentation for BWidget's ScrolledWindow. Hopefully people will provide examples of using this widget.
Jos Decoster Some examples of using BWidget's ScrolledWindow. First, make a frame scrollable:
package require BWidget # Make a frame scrollable set sw [ScrolledWindow .sw] pack $sw -fill both -expand true set sf [ScrollableFrame $sw.sf] $sw setwidget $sf set uf [$sf getframe] # Now fill the frame, resize the window to see the scrollbars in action for { set i 0 } { $i < 20 } { incr i } { for { set j 0 } { $j < 20 } { incr j } { set nm [format "%s.b_%s_%s" $uf $i $j] set b [button $nm -text "$i,$j"] grid $b -row $i -column $j } }
A text widget can be make scrollable like this:
package require BWidget # Make a text-widget scrollable set sw [ScrolledWindow .sw] pack $sw -fill both -expand true set txt [text $sw.txt -wrap none] $sw setwidget $txt # Insert some text, resize the window to see the scrollbars in action $txt insert end {README: Tcl This is the Tcl 8.4.3 source distribution. Tcl/Tk is also available through NetCVS: http://tcl.sourceforge.net/ You can get any source release of Tcl from the file distributions link at the above URL. }
Listboxes (standard Tk or BWidget) can be make scrollable like this:
package require BWidget # Make a tk-listbox scrollable set swtk [ScrolledWindow .swtk] pack $swtk -fill both -expand true set lbtk [listbox $swtk.lbtk] $swtk setwidget $lbtk # Make a BWidget-listbox scrollable set swbw [ScrolledWindow .swbw] pack $swbw -fill both -expand true set lbbw [ListBox $swbw.lbbw] $swbw setwidget $lbbw # Now fill the listbox, resize the window to see the scrollbars in action for { set i 0 } { $i < 100 } { incr i } { $lbtk insert end "This is item $i" $lbbw insert $i $i -text "This is item $i" }