Tk Source Code

View Ticket
Login
Ticket UUID: a296cf46c6e9873ca03162a38e434d437aec8e74
Title: [pack propagate $w 0] doesn't restore the size of the once shrunk widget
Type: Bug Version: 8.6.12
Submitter: erikleunissen Created on: 2022-04-09 12:25:53
Subsystem: 48. Geometry Management Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2022-07-01 20:01:18
Resolution: None Closed By: nobody
    Closed on:
Description:
The command [pack propagate] is used to shrink a container widget to fit tightly around a contained widget.

When a container widget has adjusted its geometry once, the "shrink-wrapped size" persists, even after:
- doing [pack propagate $w 0]
- additionally, unmapping the child widget using [pack forget]
- additionally, destroying the child widget around which the shrinking happened

The shrunk size of the container widget persists, even in the absence of a contained window to shrink to.

In order to effectively restore the actual size of the container widget to its originally configured size, it is necessary that the container widget is "reconfigured" once more, issuing a seemingly useless command that doesn't change anything to the configuration settings themselves:

    [$w configure -width [$w cget -width] -height [$w cget -height]]

I don't understand this persistent behaviour. Is this intended (for some reason that I failed to see)?
If it is, then I believe that it's wise to document the persistent behaviour in order to prevent misunderstanding and surprise.

The attached script exercise.tcl demonstrates this persistent state of the "once shrinked size".
User Comments: erikleunissen added on 2022-07-01 20:01:18:
hmmm, the last difference is incorrectly worded. I meant:

- it has an extra reason for the current behaviour being undesirable: the issue exhibits even after having explicitly issued a command addressing the resizing behaviour of the very same container widget: [pack propagate $w 0]. I.e it's not the indirect consequence of something that happened to a child widget.

erikleunissen added on 2022-07-01 13:04:51:
Yes I see the similarities. However, the current ticket has a few differences:

- it's about all sorts of container widgets, not just frames
- being targeted at the auto-shrinking behaviour of [pack propagate], it's about restoring to the requested size of the container widget, not to the standard initial size of 1x1 pixel
- it has an extra reason for the current behaviour being undesirable: the auto-shrinking behaviour doesn't respond to a user-command explicitly meant for that purpose, and targeted at the same widget: [pack propagate $w 0]. I.e it's not the indirect consequence of something that happened to a child widget.

Despite these differences, the same adverse effects as described in TIP #454 (like flickering) may be the reason for allowing the surprising behaviour, I don't know that.

fvogel added on 2022-06-20 20:47:23:

The bottom of this looks very much mike the reasons why TIP #454 was finally withdrawn, see https://core.tcl-lang.org/tips/doc/trunk/tip/454.md.


Attachments: