summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-02-24 17:32:24 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-02-24 17:32:24 (GMT)
commit1b0adcf04a83a228748415aa2c01506890ea8941 (patch)
treea2872eed910efedce574271dbc3abcf3f5590332
parentdb0f75aaee952d79eac60d9f4e4179441c040d55 (diff)
downloadtk-1b0adcf04a83a228748415aa2c01506890ea8941.zip
tk-1b0adcf04a83a228748415aa2c01506890ea8941.tar.gz
tk-1b0adcf04a83a228748415aa2c01506890ea8941.tar.bz2
Fixed bug [2262543] - Scale widget unexpectedly fires command callbackbug_2262543fff
-rw-r--r--generic/tkScale.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index cc7c294..cbc5202 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -303,6 +303,12 @@ Tk_ScaleObjCmd(
return TCL_ERROR;
}
+ /*
+ * The widget was just created, no command callback must be invoked.
+ */
+
+ scalePtr->flags &= ~INVOKE_COMMAND;
+
Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -1268,7 +1274,14 @@ TkScaleSetValue(
return;
}
scalePtr->value = value;
- if (invokeCommand) {
+
+ /*
+ * Schedule command callback invocation only if there is such a command
+ * already registered, otherwise the callback would trigger later when
+ * configuring the widget -command option even if the value did not change.
+ */
+
+ if ((invokeCommand) && (scalePtr->command != NULL)) {
scalePtr->flags |= INVOKE_COMMAND;
}
TkEventuallyRedrawScale(scalePtr, REDRAW_SLIDER);