Version 10 of ttk::panedwindow

Updated 2013-11-29 18:23:47 by pooryorick

[panedwindow ] creates and manipulates panedwindow widgets

Also called tk::panedwindow in Tk 8.5.

See Also

ttk::panedwindow

Documentation

official reference

Ttk, released in Tk 8.5, has a themed panedwindow: http://www.tcl.tk/man/tcl8.5/TkCmd/ttk_panedwindow.htm .

See also paned window.


Here is information on Iwidgets implementation:

http://incrtcl.sourceforge.net/iwidgets/iwidgets/panedwindow.gif

Docs can be found at http://incrtcl.sourceforge.net/iwidgets/iwidgets/panedwindow.html (the example provided may be outdated and fail to work with the latest Tcl/Tk) and http://purl.org/tcl/home/man/iwidgets3.0/panedwindow.n.html


Some users with iwidget panedwindows in their apps find that, when moving to Tk 8.4 , their applications are now generating syntax errors. This is because the Tk panedwindow and iwidgets panedwindow widgets use the same class - however, they don't have the same bindings.

Tom Silva writes on the itcl mailing list: I use this code-fix in panedwindow.itk, in the Panedwindow constructor, down near the bottom (just before "eval itk_initialize $args").

  set btags [bindtags $itk_component(hull)]
  if {[set ndx [lsearch -exact $btags Panedwindow]] >= 0} {
    bindtags $itk_component(hull) [lreplace $btags $ndx $ndx IPanedwindow]
  }

Prompted by an observation by Bryan Oakley that, whereas

    [winfo manager $w] forget $w

does what one want for $w-s managed by pack, place, and grid, but not for panedwindow, Joe English offered this "interesting solution":

    set scratch [winfo parent $w].__temp__
    pack $w in $scratch
    pack forget $w
    destroy $scratch 

RS 2006-01-29: Hacking a Tk panedwindow with eTcl on my phone, I wasn't sure whether to arrange panes horizontally or vertically. Well, thought I, let the user decide - took me 4 lines of code, plus the demo below. Right-click on the sash to toggle:

 proc toggle'orientation w {
   $w config -ori [expr {[$w cget -ori] eq "horizontal"? "vert": "hori"}]
 }
#-- Demo and usage example:
 pack [panedwindow .p]
 .p add [label .p.1 -text Hello]
 .p add [label .p.2 -text world]
 bind .p <3> {toggle'orientation %W}

SeS (23-10-2011):

I have been using the iwidgets panedwindow for some time now and it is also provided inside tG² since the Layout Editor's early conception/implementation. I have encountered a behaviour which is only observed in the iwidgets implementation of Panedwindow. It is the constant flickering of the child widgets of a panedwindow if the panedwindow is packed and the toplevel geometry is changed.

See for yourself:

Using Windows Vista, using wish.exe with $tcl_version 8.4, Iwidgets 4.0.2

  package require Iwidgets
  iwidgets::panedwindow .pw -width 200 -height 200
  pack .pw
  .pw add [frame .pane0]
  .pw add [frame .pane1]
  .pw add [frame .pane2]
  .pw add [frame .pane3]
  pack [button .pw.pane0.b -text test] -expand 1 -fill x
  pack [button .pw.pane1.b -text test] -expand 1 -fill x
  pack [button .pw.pane2.b -text test] -expand 1 -fill x
  pack [button .pw.pane3.b -text test] -expand 1 -fill x

Now, resize the toplevel and pay close attention to the buttons we just created...the flickering becomes more severe with more embedded widgets. Do the same with the ttk panedwindow implementation in a fresh 'wish' and see the diff's:

  panedwindow .pw -width 200 -height 200 -orient vertical
  pack .pw
  frame .pw.pane0; .pw add .pw.pane0
  frame .pw.pane1; .pw add .pw.pane1
  frame .pw.pane2; .pw add .pw.pane2
  frame .pw.pane3; .pw add .pw.pane3
  pack [button .pw.pane0.b -text test] -expand 1 -fill x
  pack [button .pw.pane1.b -text test] -expand 1 -fill x
  pack [button .pw.pane2.b -text test] -expand 1 -fill x
  pack [button .pw.pane3.b -text test] -expand 1 -fill x

For some people, this flickering might be a minor thing, imo it is important to reduce such strange displaying just to provide the user a cool and relaxed GUI and if there is a chance to get rid of it I will certainly persuit it. One of the main reasons I recently added the ttk panedwindow implementation also to tG²'s layout editor. Should have done that in the first place, anyway, better late than never they say.


SeS (23-10-2011 - 10:27am CET): BTW, this observation will change from OS to OS and from PC to PC. Using Win7 & a different PC & monitor gives me almost unnoticable differences between the iwidgets & ttk panedwindow...