1proc Scrolled_Text { f args } {
2   frame $f
3   text $f.txt -font {fixed 10} \
4      -xscrollcommand [list Scrolled_Text.set $f.xscroll  [list grid $f.xscroll -row 1 -column 0 -sticky news]] \
5      -yscrollcommand [list Scrolled_Text.set $f.yscroll  [list grid $f.yscroll -row 0 -column 1 -sticky news]]
6   eval {$f.txt configure} $args
7   scrollbar $f.xscroll -orient horizontal -command [list $f.txt xview]
8   scrollbar $f.yscroll -orient vertical   -command [list $f.txt yview]
9
10   catch {
11     eval $f.xscroll configure [gui::getStyle $::guiXML styleScrollBar]
12     eval $f.yscroll configure [gui::getStyle $::guiXML styleScrollBar]
13   } ;# catch
14
15   grid $f.txt -sticky news
16   ;##
17   ;# Only the data should expand, not the scroll bars
18   ;#
19   grid rowconfigure    $f 0 -weight 1
20   grid columnconfigure $f 0 -weight 1
21
22   grid columnconfigure $f 1 -minsize 1
23   grid rowconfigure    $f 1 -minsize 1
24   return $f.txt
25}
26#******************************************************#
27# Function   : Scroll_set
28# Description: callback for the scroll list box, hide
29#              scroll bars if they aren't needed
30# Author     : Tom Wilkason
31# Date       : 6/4/1999
32#*******************************************************#
33proc Scrolled_Text.set {scrollbar geoCmd offset size} {
34   if {$offset != 0.0 || $size != 1.0} {
35      eval $geoCmd
36      $scrollbar set $offset $size
37   } else {
38      set manager [lindex $geoCmd 0]
39      $manager forget $scrollbar
40   } ;# end if
41}
42
43
44
45
46
47
48