Posted to tcl by jenglish at Mon Oct 26 17:06:16 GMT 2009view raw

  1.  
  2. package require Tk
  3.  
  4. variable stuff
  5. for {set i 1} {$i < 99} {incr i} { lappend stuff [format "Line %d" $i] }
  6. proc clientWindow {w} {
  7. listbox $w -height 20 -listvariable stuff
  8. return $w;
  9. }
  10.  
  11. proc windowsash {pw} {
  12. ttk::panedwindow $pw
  13. $pw add [ttk::frame $pw.top -width 200 -height 100]
  14. $pw add [ttk::frame $pw.bot -width 200 -height 100]
  15. place [clientWindow $pw.top.c] \
  16. -anchor nw -relx 0 -relwidth 1 -rely 0
  17. place [clientWindow $pw.bot.c] \
  18. -anchor sw -relx 0 -relwidth 1 -rely 1
  19. update idletasks;
  20. set h [winfo reqheight $pw.top.c]
  21. $pw configure -height $h
  22. $pw sashpos 0 [expr {$h/2}]
  23. return $pw
  24. }
  25.  
  26. pack [windowsash .pw] -expand true -fill both

Comments

Posted by jenglish at Mon Oct 26 17:07:20 GMT 2009 [text] [code]

First attempt. Doesn't handle scrolling or resizing.

Posted by jenglish at Mon Oct 26 18:03:41 GMT 2009 [text] [code]

... and handling scrolling and resizing turned out to be more difficult than I expected. This approach might be a nonstarter.