Posted to tcl by Bradipo at Thu Jul 25 17:36:27 GMT 2024view pretty
proc handle {w} {
$w delete 1.0 end
$w configure -height 1
return -code break
}
proc view {w} {
puts stderr [binary encode hex [$w get 1.0 end]]
}
proc increase {w} {
set height [$w cget -height]
$w configure -height [incr height]
}
frame .f
panedwindow .f.p -orient horizontal
.f.p add [frame .f.p.l]
.f.p add [panedwindow .f.p.r -orient vertical]
frame .f.p.l.top
frame .f.p.l.bot
labelframe .f.p.l.top.lf -text "A Labeled Framed"
label .f.p.l.top.lf.l -text "A Label in Labeled Frame"
text .f.p.l.bot.txt -width 80 -height 1 -setgrid 1 -wrap word
.f.p.r add [labelframe .f.p.r.top -text "Top Labeled Frame"]
.f.p.r add [labelframe .f.p.r.bot -text "Bottom Labeled Frame"]
for {set x 0} {$x < 10} {incr x} {
label .f.p.r.top.l$x -text [format "Label %d in Top Labeled Frame" $x]
pack .f.p.r.top.l$x -expand 1
}
text .f.p.r.bot.txt -width 80 -height 1 -setgrid 1 -wrap word
pack .f.p.l.top.lf.l -expand 1
pack .f.p.l.top.lf -expand 1 -fill both
pack .f.p.l.top -side top -expand 1 -fill both
pack .f.p.l.bot -expand 0 -fill both
pack .f.p.r.bot.txt -expand 1 -fill both
pack .f.p.l.bot.txt -expand 1 -fill both
pack .f.p
pack .f
bind .f.p.r.bot.txt <Return> [list handle .f.p.r.bot.txt]
bind .f.p.r.bot.txt <Control-Return> [list increase .f.p.r.bot.txt]
bind .f.p.l.bot.txt <Return> [list handle .f.p.l.bot.txt]
bind .f.p.l.bot.txt <Control-Return> [list increase .f.p.l.bot.txt]
focus .f.p.r.bot.txt