Posted to tcl by Bradipo at Thu Jul 25 17:36:27 GMT 2024view raw

  1. proc handle {w} {
  2. $w delete 1.0 end
  3. $w configure -height 1
  4. return -code break
  5. }
  6. proc view {w} {
  7. puts stderr [binary encode hex [$w get 1.0 end]]
  8. }
  9. proc increase {w} {
  10. set height [$w cget -height]
  11. $w configure -height [incr height]
  12. }
  13.  
  14. frame .f
  15. panedwindow .f.p -orient horizontal
  16. .f.p add [frame .f.p.l]
  17. .f.p add [panedwindow .f.p.r -orient vertical]
  18. frame .f.p.l.top
  19. frame .f.p.l.bot
  20. labelframe .f.p.l.top.lf -text "A Labeled Framed"
  21. label .f.p.l.top.lf.l -text "A Label in Labeled Frame"
  22. text .f.p.l.bot.txt -width 80 -height 1 -setgrid 1 -wrap word
  23. .f.p.r add [labelframe .f.p.r.top -text "Top Labeled Frame"]
  24. .f.p.r add [labelframe .f.p.r.bot -text "Bottom Labeled Frame"]
  25. for {set x 0} {$x < 10} {incr x} {
  26. label .f.p.r.top.l$x -text [format "Label %d in Top Labeled Frame" $x]
  27. pack .f.p.r.top.l$x -expand 1
  28. }
  29. text .f.p.r.bot.txt -width 80 -height 1 -setgrid 1 -wrap word
  30. pack .f.p.l.top.lf.l -expand 1
  31. pack .f.p.l.top.lf -expand 1 -fill both
  32. pack .f.p.l.top -side top -expand 1 -fill both
  33. pack .f.p.l.bot -expand 0 -fill both
  34. pack .f.p.r.bot.txt -expand 1 -fill both
  35. pack .f.p.l.bot.txt -expand 1 -fill both
  36. pack .f.p
  37. pack .f
  38.  
  39. bind .f.p.r.bot.txt <Return> [list handle .f.p.r.bot.txt]
  40. bind .f.p.r.bot.txt <Control-Return> [list increase .f.p.r.bot.txt]
  41. bind .f.p.l.bot.txt <Return> [list handle .f.p.l.bot.txt]
  42. bind .f.p.l.bot.txt <Control-Return> [list increase .f.p.l.bot.txt]
  43. focus .f.p.r.bot.txt
  44.