diff options
author | ericm <ericm> | 2000-01-20 23:46:20 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-01-20 23:46:20 (GMT) |
commit | 08776342a8dd10c3f9f3cbba8655a1e4abbafafc (patch) | |
tree | a64375903efa812908da558697622cf750421827 | |
parent | 028293934889d9f696d2315b98e902adb757bd68 (diff) | |
download | tk-08776342a8dd10c3f9f3cbba8655a1e4abbafafc.zip tk-08776342a8dd10c3f9f3cbba8655a1e4abbafafc.tar.gz tk-08776342a8dd10c3f9f3cbba8655a1e4abbafafc.tar.bz2 |
* tests/grid.test: Added a test for the consecutive ^ and multiple
widget case (bug #1386).
* generic/tkGrid.c: Fixed interpretation of consecutive ^
characters in grid command. Previously, ^ ^ was interpreted as
meaning that there must be a 2-column widget above to extend,
neglecting the case where there was actually 2 1-column widgets
above. Now, ^ ^ is interpreted as a possible width; the gridder
will consume as many ^'s as there are columns in the widget, and
leave the rest for the extension of other widgets. (bug #1386).
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | generic/tkGrid.c | 24 | ||||
-rw-r--r-- | tests/grid.test | 18 |
3 files changed, 51 insertions, 11 deletions
@@ -1,3 +1,23 @@ +2000-01-20 Eric Melski <ericm@scriptics.com> + + * tests/grid.test: Added a test for the consecutive ^ and multiple + widget case (bug #1386). + + * generic/tkGrid.c: Fixed interpretation of consecutive ^ + characters in grid command. Previously, ^ ^ was interpreted as + meaning that there must be a 2-column widget above to extend, + neglecting the case where there was actually 2 1-column widgets + above. Now, ^ ^ is interpreted as a possible width; the gridder + will consume as many ^'s as there are columns in the widget, and + leave the rest for the extension of other widgets. (bug #1386). + +2000-01-19 Eric Melski <ericm@scriptics.com> + + * library/tk.tcl: Created a virtual event <<PrevWindow>> for + reverse tab traversals, with one default binding <Shift-Tab>, and + OS specific bindings for Linux, HP-UX, and IRIX. (bug #3163) + + 2000-01-13 Jeff Hobbs <hobbs@scriptics.com> * changes: updated changes file to reflect 8.3b2 mods diff --git a/generic/tkGrid.c b/generic/tkGrid.c index fbc8306..5b4f9b8 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.6 1999/11/10 02:56:25 hobbs Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.7 2000/01/20 23:46:20 ericm Exp $ */ #include "tkInt.h" @@ -2505,6 +2505,7 @@ ConfigureSlaves(interp, tkwin, argc, argv) return TCL_ERROR; } + /* Count the number of consecutive ^'s starting from this position */ for (width=1; width+j < numWindows && *argv[j+width] == REL_VERT; width++) { /* Null Body */ @@ -2517,7 +2518,7 @@ ConfigureSlaves(interp, tkwin, argc, argv) if (lastWindow == NULL) { if (masterPtr->masterDataPtr != NULL) { SetGridSize(masterPtr); - lastRow = masterPtr->masterDataPtr->rowEnd - 1; + lastRow = masterPtr->masterDataPtr->rowEnd - 2; } else { lastRow = 0; } @@ -2525,27 +2526,30 @@ ConfigureSlaves(interp, tkwin, argc, argv) } else { other = Tk_NameToWindow(interp, lastWindow, tkwin); otherPtr = GetGrid(other); - lastRow = otherPtr->row; + lastRow = otherPtr->row + otherPtr->numRows - 2; lastColumn = otherPtr->column + otherPtr->numCols; } for (match=0, slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - if (slavePtr->numCols == width - && slavePtr->column == lastColumn - && slavePtr->row + slavePtr->numRows == lastRow) { - slavePtr->numRows++; - match++; + if (slavePtr->column == lastColumn + && slavePtr->row + slavePtr->numRows - 1 == lastRow) { + if (slavePtr->numCols <= width) { + slavePtr->numRows++; + match++; + j += slavePtr->numCols - 1; + lastWindow = Tk_PathName(slavePtr->tkwin); + break; + } } - lastWindow = Tk_PathName(slavePtr->tkwin); } if (!match) { Tcl_AppendResult(interp, "can't find slave to extend with \"^\".", (char *) NULL); return TCL_ERROR; } - j += width - 1; +/* j += width - 1; */ } if (masterPtr == NULL) { diff --git a/tests/grid.test b/tests/grid.test index bff0bfa..d80f1a9 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.6 1999/11/13 01:23:01 wart Exp $ +# RCS: @(#) $Id: grid.test,v 1.7 2000/01/20 23:46:21 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -784,6 +784,22 @@ test grid-11.14 {default widget placement} { } {{0,25 50,50} {50,0 50,50} {50,50 50,50}} grid_reset 11.14 +test grid-11.15 {^ ^ test with multiple windows} { + foreach i {1 2 3 4} { + frame .f$i -width 50 -height 50 -bd 1 -relief solid + } + grid .f1 .f2 .f3 -sticky ns + grid .f4 ^ ^ + update + set a "" + foreach i {1 2 3 4} { + lappend a "[winfo x .f$i],[winfo y .f$i]\ + [winfo width .f$i],[winfo height .f$i]" + } + set a +} {{0,0 50,50} {50,0 50,100} {100,0 50,100} {0,50 50,50}} +grid_reset 11.15 + test grid-12.1 {-sticky} { catch {unset data} frame .f -width 200 -height 100 -highlightthickness 0 -bg red |