summaryrefslogtreecommitdiffstats
path: root/generic/tkEntry.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-07-25 21:19:01 (GMT)
committerhobbs <hobbs>2002-07-25 21:19:01 (GMT)
commitc405da7b48b5b98e265a61df3590913ebc571bdd (patch)
tree98c02ac7c51ab626663578ecf3c18a172c0a96e6 /generic/tkEntry.c
parent1a2ea25789ca5a4a1abc69556705edeee9ab6d14 (diff)
downloadtk-c405da7b48b5b98e265a61df3590913ebc571bdd.zip
tk-c405da7b48b5b98e265a61df3590913ebc571bdd.tar.gz
tk-c405da7b48b5b98e265a61df3590913ebc571bdd.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]
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r--generic/tkEntry.c39
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);