summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2006-06-14 22:17:06 (GMT)
committerdgp@users.sourceforge.net <dgp>2006-06-14 22:17:06 (GMT)
commit33dc27b6c3028a951447e5686654ed11e6632e74 (patch)
tree1e0cbf5d871c599db15f7df46c8c6ef24a79a622 /generic
parent706eed6f5c5c73dab073303f4ebaaa83e5554329 (diff)
downloadtk-33dc27b6c3028a951447e5686654ed11e6632e74.zip
tk-33dc27b6c3028a951447e5686654ed11e6632e74.tar.gz
tk-33dc27b6c3028a951447e5686654ed11e6632e74.tar.bz2
* generic/tkScale.c: Revised variable writing logic to account
for [scale]'s design that it deals with its value as a formatted string, and not as a double. [Bug 891141].
Diffstat (limited to 'generic')
-rw-r--r--generic/tkScale.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index b97485a..4ff6157 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkScale.c,v 1.22 2005/11/17 16:21:56 dkf Exp $
+ * RCS: @(#) $Id: tkScale.c,v 1.23 2006/06/14 22:17:06 dgp Exp $
*/
#include "tkPort.h"
@@ -563,7 +563,7 @@ ConfigureScale(
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
int error;
- double oldValue = scalePtr->value;
+ double varValue;
/*
* Eliminate any existing trace on a variable monitored by the scale.
@@ -674,10 +674,17 @@ ConfigureScale(
valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL,
TCL_GLOBAL_ONLY);
- if ((valuePtr == NULL) || (scalePtr->value != oldValue)
- || (Tcl_GetDoubleFromObj(NULL, valuePtr, &oldValue) != TCL_OK)
- || (scalePtr->value != oldValue)) {
+ if ((valuePtr == NULL) || (Tcl_GetDoubleFromObj(NULL,
+ valuePtr, &varValue) != TCL_OK)) {
ScaleSetVariable(scalePtr);
+ } else {
+ char varString[TCL_DOUBLE_SPACE];
+ char scaleString[TCL_DOUBLE_SPACE];
+ sprintf(varString, scalePtr->format, varValue);
+ sprintf(scaleString, scalePtr->format, scalePtr->value);
+ if (strcmp(varString, scaleString)) {
+ ScaleSetVariable(scalePtr);
+ }
}
Tcl_TraceVar(interp, Tcl_GetString(scalePtr->varNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,