From 710831109cda3c52776675f9ccb41102804fae08 Mon Sep 17 00:00:00 2001 From: "peter.spjuth@gmail.com" Date: Thu, 10 Oct 2002 21:07:51 +0000 Subject: The grid size was not updated properly when removing a widget from a grid. [Bug #621241] (forssen) --- ChangeLog | 6 ++++++ generic/tkGrid.c | 11 +++-------- tests/grid.test | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c9a4e5..aa4669d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-10-10 Peter Spjuth + + * tests/grid.test: + * generic/tkGrid.c: The grid size was not updated properly + when removing a widget from a grid. [Bug #621241] (forssen) + 2002-10-10 Jeff Hobbs * tests/canvPs.test: tests for canvas embedded window ps generation diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 27f9dde..f5c3503 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGrid.c,v 1.24 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.25 2002/10/10 21:07:51 pspjuth Exp $ */ #include "tkInt.h" @@ -2342,18 +2342,15 @@ Unlink(slavePtr) register Gridder *slavePtr; /* Window to unlink. */ { register Gridder *masterPtr, *slavePtr2; - GridMaster *gridPtr; /* pointer to grid data */ masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { return; } - gridPtr = masterPtr->masterDataPtr; if (masterPtr->slavePtr == slavePtr) { masterPtr->slavePtr = slavePtr->nextPtr; - } - else { + } else { for (slavePtr2 = masterPtr->slavePtr; ; slavePtr2 = slavePtr2->nextPtr) { if (slavePtr2 == NULL) { panic("Unlink couldn't find previous window"); @@ -2372,9 +2369,7 @@ Unlink(slavePtr) *masterPtr->abortPtr = 1; } - if ((slavePtr->numCols+slavePtr->column == gridPtr->columnMax) - || (slavePtr->numRows+slavePtr->row == gridPtr->rowMax)) { - } + SetGridSize(slavePtr->masterPtr); slavePtr->masterPtr = NULL; } diff --git a/tests/grid.test b/tests/grid.test index daeef7e..c47348e 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: grid.test,v 1.16 2002/07/13 21:52:34 dgp Exp $ +# RCS: @(#) $Id: grid.test,v 1.17 2002/10/10 21:07:52 pspjuth Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -1497,6 +1497,26 @@ test grid-19.1 {uniform realloc} { } {0 0 600 20} grid_reset 19.1 +test grid-20.1 {recalculate size after removal (destroy)} { + label .l1 -text l1 + grid .l1 -row 2 -column 2 + destroy .l1 + label .l2 -text l2 + grid .l2 + grid size . +} {1 1} +grid_reset 20.1 + +test grid-20.2 {recalculate size after removal (forget)} { + label .l1 -text l1 + grid .l1 -row 2 -column 2 + grid forget .l1 + label .l2 -text l2 + grid .l2 + grid size . +} {1 1} +grid_reset 20.2 + # cleanup ::tcltest::cleanupTests return -- cgit v0.12