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

package require Tk

variable stuff
for {set i 1} {$i < 99} {incr i} { lappend stuff [format "Line %d" $i] }
proc clientWindow {w} {
    listbox $w -height 20 -listvariable stuff
    return $w;
}

proc windowsash {pw} {
    ttk::panedwindow $pw
    $pw add [ttk::frame $pw.top -width 200 -height 100]
    $pw add [ttk::frame $pw.bot -width 200 -height 100]
    place [clientWindow $pw.top.c] \
        -anchor nw -relx 0 -relwidth 1 -rely 0
    place [clientWindow $pw.bot.c] \
        -anchor sw -relx 0 -relwidth 1 -rely 1
    update idletasks;
    set h [winfo reqheight $pw.top.c]
    $pw configure -height $h
    $pw sashpos 0 [expr {$h/2}]
    return $pw
}

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.