Tk Source Code

View Ticket
Login
Ticket UUID: 1217762
Title: panedwindow geom manager bug when sash was moved
Type: Bug Version: obsolete: 8.4.10
Submitter: fvogel Created on: 2005-06-09 20:30:03
Subsystem: 48. Geometry Management Assigned To: chengyemao
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2014-02-19 21:42:08
Resolution: Invalid Closed By: fvogelnew1
    Closed on: 2006-03-19 19:07:34
Description:
I try to make a button visible at all times at the bottom 
of a window containing a panedwindow with two panes 
and a frame containing a button.

When I resize the window by dragging its lower border, 
everything seems to go well *if the sash was not moved 
before*. Otherwise the button gets clipped.

I read in the man panedwindow that the panedwindow 
resizes its last pane to fill its allocated space, and this 
is what's actually happening *only when the sash was 
never moved before*. If the sash has been moved, then 
the wm clips first the button and only after that it 
resizes the last pane.

I believe this is a bug of the geometry manager.

Here is a snippet to reproduce:

#########
wm resizable . 1 1
panedwindow .pw -orient vertical
label .pw.x1 -text Upper -fg orange -bg black
label .pw.x2 -text Lower -fg white -bg red
.pw add .pw.x1 -minsize 150
.pw add .pw.x2 -minsize 100
pack .pw -fill both -expand yes
frame .f
button .f.b -text "hello!"
pack .f.b
pack .f
update
wm minsize . [winfo width .] [winfo height .]
set initminh [lindex [wm minsize .] 1]
bind . <Configure> { \
  set sashcoord [.pw sash coord 0];\
  set madedown [expr [lindex $sashcoord 1] - 154];\
  set newminheight [expr $initminh + $madedown];\
  wm minsize . 200 $newminheight; \
}
#########

Run this in a wish session, and try to resize the 
window -> the button is never clipped.

Now move the sash down, then move it up, and try to 
resize again -> the button gets clipped!!

The geometry manager should first remove the extra 
space in .pw.x2 before it clips the frame. I found no way 
to manually set the height of .pw.x2

Note that I use Tcl/Tk 8.4.10 (patch 1124198 is 
therefore already in use).

Francois
User Comments: fvogelnew1 added on 2006-03-20 02:07:34:
Logged In: YES 
user_id=1245417

OK, since everybody seems to consider this is explained 
clearly enough in the help page, I close this bug.

Thanks,
Francois

wildcard_25 added on 2006-03-18 22:12:22:
Logged In: YES 
user_id=596509

The section "THE PACKER ALGORITHM" explains how items are 
packed quite clearly.

The cause of confusion seems to be that the panedwindow 
has a dynamic size to start with, once the sash has been 
moved it has a 'set' size.

The following script shows the same behaviour, without the 
unneeded extras-
wm resizable . 0 1
panedwindow .pw -orient vertical -width 200
label .pw.x1 -text Upper -fg orange -bg black
label .pw.x2 -text Lower -fg white -bg red
.pw add .pw.x1 -minsize 150
.pw add .pw.x2 -minsize 100
button .b -text "hello!"
pack .pw -fill both -expand yes
pack .b -side bottom -expand no

Make the window smaller vertically (ie smaller than the 
minimum size that the wm determined was large enough to 
hold all the widgets without clipping) and the last packed 
widget is clipped, that being the button.

Also, if the window is made larger and then the sash is 
moved, thus giving the panedwindow a 'set' height, then 
making the window smaller than its new required height 
will once again make the last packed widget clip.

Reverse the last two lines to get desired operation.

fvogelnew1 added on 2006-03-18 20:14:06:
Logged In: YES 
user_id=1245417

Adding a few lines in the help pages should let us close 
this bug quickly, no?

Francois

fvogelnew1 added on 2005-06-13 01:54:42:
Logged In: YES 
user_id=1245417

Brilliant, it works!

I'm just wondering how I could have figured this out? I read 
again the help page for the pack command very carefully and 
I don't think this is stated. Your recipe is actually working for 
me but I don't understand why I must do the things this way.

Is it because of the packing order? The last slave gets the 
remaining space, and that's all? Well, if you could elaborate 
a bit on this and maybe add some information in the help 
page, I would be grateful.

Thanks,
Francois

chengyemao added on 2005-06-11 09:28:11:
Logged In: YES 
user_id=191079

This is a feature of Tk pack command, not a bug.
In order to make the button visiable all time in resizing 
window, pack the button first at the bottom (-side bottom).  
Then pack the panewindow at the top (-side top)