Check-in [9e7d404a8b]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:EEscape "<<" in markdown to show it literally
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9e7d404a8b1dc34bec0cbcf88f6ca76af31c044afdd0e3e9cbb961a532fcac98
User & Date: oehhar 2018-09-22 19:33:28
Context
2018-09-23
09:53
TIP518: discussion why not use virtual event <<Configure>> instead <<NoManagedChild>>. Use consistently <<NoManagedChild>> (not <<NoManagedChilds>>) check-in: 475fbebb73 user: oehhar tags: trunk
07:58
Fix formatting bug in 426. Clarify a bit of confusing wording. check-in: cacd40b86f user: dkf tags: trunk
2018-09-22
19:33
EEscape "<<" in markdown to show it literally check-in: 9e7d404a8b user: oehhar tags: trunk
19:20
New TIP518: Event on last child unmanaged (follow-up of tip454) check-in: 64c713d7f4 user: oehhar tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/454.md.

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
It just solves the issue by restoring initial size if the last children is unpacked/ungridded.

This is not backward compatible.
But that is a side effect of fixing this bug.

# Rejected Proposal

Another proposal is to invoke the virtual event <<GeometryManager>> when the last children is unpacked/ungridded/destroyed.

Emiliano has provided a ticket 2863003fff <https://core.tcl.tk/tk/info/2863003fff>  with the implementation in branch bug-d6b95ce492 <https://core.tcl.tk/tk/timeline?r=bug-d6b95ce492&nd&c=2016-09-21+06%3A32%3A55&n=200> :

The virtual event **<<GeometryManager>>** is defined which informs the master \(a frame-like widget\) that it has no child widget any more and that its size is not managed any more by grid/pack.

The program may bind to this event and resize to size 1x1:

	   bind .c <<GeometryManager>> "resizeFrame %W"
	   proc resizeFrame w {
	      $w configure -height 1 -width 1
	      $w configure -height 0 -width 0






|



|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
It just solves the issue by restoring initial size if the last children is unpacked/ungridded.

This is not backward compatible.
But that is a side effect of fixing this bug.

# Rejected Proposal

Another proposal is to invoke the virtual event \<\<GeometryManager\>\> when the last children is unpacked/ungridded/destroyed.

Emiliano has provided a ticket 2863003fff <https://core.tcl.tk/tk/info/2863003fff>  with the implementation in branch bug-d6b95ce492 <https://core.tcl.tk/tk/timeline?r=bug-d6b95ce492&nd&c=2016-09-21+06%3A32%3A55&n=200> :

The virtual event **\<\<GeometryManager\>\>** is defined which informs the master \(a frame-like widget\) that it has no child widget any more and that its size is not managed any more by grid/pack.

The program may bind to this event and resize to size 1x1:

	   bind .c <<GeometryManager>> "resizeFrame %W"
	   proc resizeFrame w {
	      $w configure -height 1 -width 1
	      $w configure -height 0 -width 0

Changes to tip/518.md.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
And there is nothing, a programmer can do, as the Configure event does not fire on the scrolled frame widget.

Another example is the scrolledwindow example by Emiliano in ticket 2863003fff <https://core.tcl.tk/tk/info/12006979562649c9> , where the solution 2 specific part may be removed \(or is ignored\).

A typical workaround is to configure the width/height manually after the last children was unmapped.
Unfortunately, this fact may not be determined for example by scrolling widgets etc. An eventual Configure binding is not firing.

Within this TIP, a new virtual event <<NoManagedChilds>> is fired to inform about no remaining childs.

# Example

Here is an example to ilustrate the issue.
It consisting of a simple scrolling megawidget.
The megawidget exposes a frame where a user may pack or grid other widgets and the scrollbar is adjusted following the changing content.
This works well when widgets are added or removed. Only removing the last client will not update the scrollbar. With the proposed patch applied, it will update the scrollbar also when the last user widget is removed.
................................................................................
	    .c configure -scrollregion [list 0 0 100 $y]
	}
	frameConfigure
	bind .c.f <Configure> frameConfigure

# Proposal

The proposal is to fire the new virtual event <<NoManagedChilds>> if the last children is unpacked/ungridded/destroyed.
A managing widget may bind to this event and do the resize of the widget or other appropriate action.

Here are additional lines for the example above.

	proc frameNoChild {} {
	    .c.f configure -height 1
	    .c.f configure -height 0






|







 







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
And there is nothing, a programmer can do, as the Configure event does not fire on the scrolled frame widget.

Another example is the scrolledwindow example by Emiliano in ticket 2863003fff <https://core.tcl.tk/tk/info/12006979562649c9> , where the solution 2 specific part may be removed \(or is ignored\).

A typical workaround is to configure the width/height manually after the last children was unmapped.
Unfortunately, this fact may not be determined for example by scrolling widgets etc. An eventual Configure binding is not firing.

Within this TIP, a new virtual event \<\<NoManagedChilds\>\> is fired to inform about no remaining childs.

# Example

Here is an example to ilustrate the issue.
It consisting of a simple scrolling megawidget.
The megawidget exposes a frame where a user may pack or grid other widgets and the scrollbar is adjusted following the changing content.
This works well when widgets are added or removed. Only removing the last client will not update the scrollbar. With the proposed patch applied, it will update the scrollbar also when the last user widget is removed.
................................................................................
	    .c configure -scrollregion [list 0 0 100 $y]
	}
	frameConfigure
	bind .c.f <Configure> frameConfigure

# Proposal

The proposal is to fire the new virtual event \<\<NoManagedChilds\>\> if the last children is unpacked/ungridded/destroyed.
A managing widget may bind to this event and do the resize of the widget or other appropriate action.

Here are additional lines for the example above.

	proc frameNoChild {} {
	    .c.f configure -height 1
	    .c.f configure -height 0