diff options
author | fvogelnew1@free.fr <fvogel> | 2016-03-07 21:00:40 (GMT) |
---|---|---|
committer | fvogelnew1@free.fr <fvogel> | 2016-03-07 21:00:40 (GMT) |
commit | ad332b925985cca5c8b8d620e340b2c8ee49ea78 (patch) | |
tree | 6c90f08137d4aaf4df153530525977dd87cca60c /generic | |
parent | d0f2e76ab5cdfb2f5400ab65016b6924f2e45cbf (diff) | |
parent | ccd2032bacbfb4b0a057cbdc6b2295e19ae23bbe (diff) | |
download | tk-ad332b925985cca5c8b8d620e340b2c8ee49ea78.zip tk-ad332b925985cca5c8b8d620e340b2c8ee49ea78.tar.gz tk-ad332b925985cca5c8b8d620e340b2c8ee49ea78.tar.bz2 |
Fixed bug [2262543] - Scale widget unexpectedly fires command callback
Diffstat (limited to 'generic')
-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); |