#!/bin/sh
# the next line starts using wish \
exec wish "$0" "$@"

package require BWidget

PanedWindow .test -side left
set p1 [.test add]
set p2 [.test add]
ScrolledWindow $p1.textbox

if {0} {
    # works no matter where sash is dragged
    set text [text $p1.textbox.text ]
} else {
    # fails when sash is dragged to top of the "2"
    set text [text .text]
}

$p1.textbox setwidget $text
pack $p1.textbox
$text insert 0.0 "1\n2\n3\n4"
button $p2.b -text hello -command { puts "hello" }
pack $p2.b
pack .test -fill both -expand yes
