Posted to tcl by suchenwi at Fri Oct 19 13:51:59 GMT 2007view raw
- proc scrolled_canvas w {
- set wp [file root $w] ;# w does not exist yet - hen/egg problem
- scrollbar $wp.y -command "$w yview"
- grid [canvas $w -xscrollc "$wp.x set" -yscrollc "$wp.y set"] \
- $wp.y -sticky ns
- grid [scrollbar $wp.x -ori hori -command "$w xview"] -sticky ew
- grid $w -sticky news
- if {$wp eq ""} {set wp .}
- grid columnconfig $wp 0 -weight 1
- #grid columnconfig $wp 1 -weight 0
- grid rowconfig $wp 0 -weight 1
- set w
- }
- pack [panedwindow .pw -sashwidth 3] -fill both -expand 1
- set t [frame .pw.t]
- set g(canvas) [scrolled_canvas $t.c]
- set f [frame .pw.f]
- .pw add $f -width 300
- .pw add $t -width 600