From be89e43c7fbc9554b9b1daa5a2ad02eb3be030b7 Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 24 Nov 1999 00:20:13 +0000 Subject: Additions to update vertical scrollbar info for listboxes when listvar changes. --- ChangeLog | 19 +++++++++++++++++++ generic/tkListbox.c | 6 +++++- tests/listbox.test | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 527b209..b988508 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1999-11-23 Eric Melski + + * tests/listbox.test: Added a test to check that the vertical + scrollbar is updated when the listvar changes. + + * generic/tkListbox.c (ListboxListVarProc): added a check that + sets the UPDATE_V_SCROLLBAR flag if the length of the listvar has + changed. + 1999-11-23 Jeff Hobbs * generic/tk.h: @@ -22,6 +31,16 @@ * win/tkWinX.c: changed GetCurrentTime to GetTickCount (the former is deprecated). [Bug: 2053] +1999-11-19 Eric Melski + + * tests/listbox.test: Added tests for itemcget and itemconfigure. + + * doc/listbox.n: Added documentation for -listvar option and for + itemconfigure and itemcget commands. + + * generic/tkListbox.c: Added support for itemconfigure/itemcget + listbox subcommands (addresses rfe #936) + 1999-11-17 Eric Melski * tests/listbox.test: Updated tests for new error messages. diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6f4f1ec..ced0620 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.11 1999/11/23 23:52:13 hobbs Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.12 1999/11/24 00:20:13 ericm Exp $ */ #include "tkPort.h" @@ -3193,6 +3193,10 @@ ListboxListVarProc(clientData, interp, name1, name2, flags) } } + if (oldLength != listPtr->nElements) { + listPtr->flags |= UPDATE_V_SCROLLBAR; + } + /* * The computed maxWidth may have changed as a result of this operation. * However, we don't want to recompute it every time this trace fires diff --git a/tests/listbox.test b/tests/listbox.test index e41d9af..3a20c07 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: listbox.test,v 1.9 1999/11/19 15:48:19 ericm Exp $ +# RCS: @(#) $Id: listbox.test,v 1.10 1999/11/24 00:20:14 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -1885,7 +1885,17 @@ test listbox-21.14 {listbox item configurations and listvar based inserts} { set x [list 1 2 3 4 a b c] .l itemcget 0 -fg } red - +test listbox-21.15 {ListboxListVarProc, update vertical scrollbar} { + catch {destroy .l} + catch {unset x} + set log {} + listbox .l -listvar x -yscrollcommand "record y" -font fixed -height 3 + pack .l + update + lappend x a b c d e f + update + set log +} [list {y 0 1} {y 0 0.5}] # UpdateHScrollbar test listbox-22.1 {UpdateHScrollbar} { catch {destroy .l} -- cgit v0.12