Version 5 of ttk::panedwindow

Updated 2008-11-17 17:20:14 by MG

Ttk's panedwindow widget.

http://www.tcl.tk/man/tcl8.5/TkCmd/ttk_panedwindow.htm

MHo 2008-04-09: Does someone know if and how it's possible to determine the dimension of a pane inside a panedwindow? I have a canvas inside a pane that holds an image. If resizing / maximizing the top-level windows, everything should grow to use the extra space. But the pane itself says it is has the dimension 1x1, and the canvas stays as its initial size (if I don't specify such initial size, something else goes wrong that is beyond the scope of this question...).

MG I've noticed with this (and other Tile widgets) in Windows / Tk 8.5 that there's a delay before sizes and things fully update - calling update and/or update idletasks doesn't resolve the problem. I've had to resort to doing something like

  $widget add $foo
  after 25 [list doStuffWith $widget]

to give the widgets time to update their sizes and report the correct ones back. See if that resolves the problem? In your case, winfo width and winfo height on the canvas may work, too?


Create a custom sash handle bar

In the default theme the sash handle bar is empty. So it is not obvious that it is a panedwindow. This little piece of code creates a new style for the panedwindow which as a Firefox-like sash handle bar.

image create photo img:sash -data {
R0lGODlhBQB5AKECADMzM9TQyP///////yH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAMALAAA
AAAFAHkAAAJOjA95y+0LUAxpUkufboLh1UFPiIyeKTqk8R1rpp5xysk1zbytoaPl/LsFczYiDlRE
Hl1J5pLXhD4DPSDLd7XChFnudgO2KC5izA6sqTQKADs=
}

ttk::style element create Sash.xsash image \
	[list img:sash ] \
	-border {1 1} -sticky ew -padding {1 1}

ttk::style layout TPanedwindow {
	Sash.xsash
}

Demo code

package require Ttk

# ttk::setTheme clam

set xf [ttk::frame .f]
set pw [ttk::panedwindow .f.pw -orient horizontal ]

ttk::frame $pw.f1
ttk::label $pw.f1.l -text "Frame 1"
pack $pw.f1.l

ttk::frame $pw.f2
ttk::label $pw.f2.l -text "Frame 2"
pack $pw.f2.l

$pw add $pw.f1
$pw add $pw.f2

pack $pw -expand 1 -fill both
pack $xf -expand 1 -fill both