Tk Source Code

View Ticket
Login
Ticket UUID: bc43fd20cf6ffdf333b8c739c42409023ccb5b15
Title: paneconfigure not working as expected
Type: Bug Version: 8.6/8.7
Submitter: gcramer Created on: 2017-05-29 21:12:48
Subsystem: 21. [panedwindow] Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-06-02 18:29:52
Resolution: Fixed Closed By: fvogel
    Closed on: 2017-06-02 18:29:52
Description:

Please test the following script:

pack [panedwindow .pw -width 400 -height 400 -orient vertical]
set a [frame .a -background green]
set b [frame .b -background orange]
.pw add .a
.pw add .b
.pw paneconfigure .a -height 200
.pw paneconfigure .b -height 200

Both panes .a and .b are configured with height 200, but .a has height 0, and .b has height 400. This result is unexpected. If I configure the height while adding the panes then it works:

pack [panedwindow .pw -width 400 -height 400 -orient vertical]
set a [frame .a -background green]
set b [frame .b -background orange]
.pw add .a -height 200
.pw add .b -height 200

But the configuring of the panes should also work after the panedwindow has been created.

User Comments: fvogel added on 2017-06-02 18:29:52:
Merged to core-8-6-branch and trunk, and closing, then. Thanks for the feedback.

gcramer added on 2017-06-02 15:47:48:
This fix looks very good. Many thanks!

fvogel added on 2017-05-31 20:19:09:

I have proposed a fix, see [e11514a75c]

The test suite for panedwindow still passes 100% OK.


gcramer added on 2017-05-30 12:28:48:

I've found out that the following work-around works:

pack [panedwindow .pw -width 400 -height 400 -orient vertical]
set a [frame .a -background green]
set b [frame .b -background orange]
.pw add .a
.pw add .b
.pw paneconfigure .a -height 200 -stretch always
.pw paneconfigure .b -height 200 -stretch always
# reset to default
.pw paneconfigure .a -stretch last
.pw paneconfigure .b -stretch last

Nevertheless the behaviour of paneconfigure is unexpected, because work-arounds have to be used. Actually the stretch option should only infect the resizing behaviour via the sash (GUI), but not when paneconfigure is used, because the latter case is causing asymmetric behaviour, and this is not transparent for the user. Moreover the current behaviour is not conform to the documentation:

height size

Specify a height for the window. The height will be the outer dimension of the window including its border, if any. If size is an empty string, or if -height is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels.