Tk Source Code

View Ticket
Login
Ticket UUID: 2062394
Title: Incompatible change in grid command
Type: Bug Version: obsolete: 8.5.4
Submitter: schmitzu Created on: 2008-08-20 13:48:53
Subsystem: 49. [grid] Assigned To: pspjuth
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-09-05 09:20:28
Resolution: Invalid Closed By: sf-robot
    Closed on: 2008-09-05 02:20:28
Description:
Tk8.5 introduces a new subcommand to grid called 
"anchor". This subcommand controls the placing of
grids which are smaller than its containing widget.
Unfortunately the default behaviour is set to
"nw" while in Tk8.4 (where you couldn't specify
the anchor) it was "center".

This leads to some broken layouts, like 
iwidgets disjointlistbox with "-buttonplacement center".

A short Tk-only example for demonstration:

<tcl>
frame .f -background blue
button .f.b1 -text "Button 1"
button .f.b2 -text "Button 2"

# uncomment next line for 8.5 compatiblity
#grid anchor .f center
grid .f.b1
grid .f.b2

pack .f -fill both -expand true
wm geometry . =200x800
</tcl>

Running this, you will see the buttons are in the
center using 8.4 and in the upper left corner 
using 8.5. For the latter the "grid anchor" line 
is necessary to yield the same result (but isn't
backward compatible).
User Comments: sf-robot added on 2008-09-05 09:20:28:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

schmitzu added on 2008-08-21 18:06:53:
Logged In: YES 
user_id=113832
Originator: YES

Re-reading TIP #146 I see the point.
So what about an anchor called "classic", which
implements the old (inconsistent) behaviour?
And, of course, this becomes the default 
behaviour, or is set as such by 
tk::classic::restore.

Just a thought...

pspjuth added on 2008-08-21 14:01:14:
Logged In: YES 
user_id=98900
Originator: NO

Note that having "center" as default is not fully
backward compatible either, as discussed in the TIP.
So I'd feel uncomfortable putting anything about this
in [tk::classic::restore].

The trivial, backward compatible, fix can be applied by anyone
affected. Noting it here for reference:
catch {grid anchor $w center}

hobbs added on 2008-08-21 06:26:33:
Logged In: YES 
user_id=72656
Originator: NO

patch from Uwe for iwidgets noted in http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/86590035a1030c71/468f247140e6059f?hl=en#468f247140e6059f applied to iwidgets.

dgp added on 2008-08-21 01:02:10:
Logged In: YES 
user_id=80530
Originator: NO


Any chance that [tk::classic::restore]
addresses this?