diff options
author | hobbs <hobbs@noemail.net> | 2002-07-25 21:19:01 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2002-07-25 21:19:01 (GMT) |
commit | a4adcd305339c4caa9aadb7b2dee4b88a9599bf6 (patch) | |
tree | 98c02ac7c51ab626663578ecf3c18a172c0a96e6 /generic/tkEntry.c | |
parent | dde5a406a7dec1864784f87dd1025b3c9286d4c9 (diff) | |
download | tk-a4adcd305339c4caa9aadb7b2dee4b88a9599bf6.zip tk-a4adcd305339c4caa9aadb7b2dee4b88a9599bf6.tar.gz tk-a4adcd305339c4caa9aadb7b2dee4b88a9599bf6.tar.bz2 |
* tests/spinbox.test: added spinbox-22.[1-3]
* generic/tkEntry.c (ConfigureEntry): made the textvariable value
take precedence over changed -from/-to values, unless it must be
constrained. [Bug #559078]
FossilOrigin-Name: fc1e3660ffa548f563431caf067e3eb14a5af349
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r-- | generic/tkEntry.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 7d78d8a..a9bd94e 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1,18 +1,20 @@ /* * Entry.c -- * - * This module implements entry widgets for the Tk - * toolkit. An entry displays a string and allows - * the string to be edited. + * This module implements entry and spinbox widgets for the Tk toolkit. + * An entry displays a string and allows the string to be edited. + * A spinbox expands on the entry by adding up/down buttons that control + * the value of the entry widget. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. + * Copyright (c) 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.29 2002/07/24 18:30:55 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.30 2002/07/25 21:19:01 hobbs Exp $ */ #include "tkInt.h" @@ -1590,6 +1592,22 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags) Tk_FreeSavedOptions(&savedOptions); } + /* + * If the entry is tied to the value of a variable, create the variable if + * it doesn't exist, and set the entry's value from the variable's value. + */ + + if (entryPtr->textVarName != NULL) { + CONST char *value; + + value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY); + if (value == NULL) { + EntryValueChanged(entryPtr, NULL); + } else { + EntrySetValue(entryPtr, value); + } + } + if (entryPtr->type == TK_SPINBOX) { ComputeFormat(sbPtr); @@ -1631,20 +1649,11 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags) } /* - * If the entry is tied to the value of a variable, then set up - * a trace on the variable's value, create the variable if it doesn't - * exist, and set the entry's value from the variable's value. + * Set up a trace on the variable's value after we've possibly + * constrained the value according to new -from/-to values. */ if (entryPtr->textVarName != NULL) { - CONST char *value; - - value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY); - if (value == NULL) { - EntryValueChanged(entryPtr, NULL); - } else { - EntrySetValue(entryPtr, value); - } Tcl_TraceVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, (ClientData) entryPtr); |