diff options
author | fvogel <fvogelnew1@free.fr> | 2016-02-24 17:32:24 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-02-24 17:32:24 (GMT) |
commit | 1b0adcf04a83a228748415aa2c01506890ea8941 (patch) | |
tree | a2872eed910efedce574271dbc3abcf3f5590332 | |
parent | db0f75aaee952d79eac60d9f4e4179441c040d55 (diff) | |
download | tk-bug_2262543fff.zip tk-bug_2262543fff.tar.gz tk-bug_2262543fff.tar.bz2 |
Fixed bug [2262543] - Scale widget unexpectedly fires command callbackbug_2262543fff
-rw-r--r-- | generic/tkScale.c | 15 |
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); |