diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkConfig.c | 7 | ||||
-rw-r--r-- | generic/tkGet.c | 9 | ||||
-rw-r--r-- | generic/tkObj.c | 6 | ||||
-rw-r--r-- | generic/tkUtil.c | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 17a3c28..642a9e5 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -962,8 +962,13 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newPixels = INT_MIN; - } else if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, + } else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr, &newPixels) != TCL_OK) { + if (nullOK && interp) { + Tcl_AppendResult(interp, "expected screen distance or \"\" but got \"", + Tcl_GetString(valuePtr), "\"", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); + } return TCL_ERROR; } if (internalPtr != NULL) { diff --git a/generic/tkGet.c b/generic/tkGet.c index 2b0e7ee..f96b566 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -601,7 +601,7 @@ Tk_GetScreenMM( error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad screen distance \"%s\"", string)); + "expected screen distance but got \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SCREEN_DISTANCE", NULL); } return TCL_ERROR; @@ -713,8 +713,9 @@ TkGetDoublePixels( } if (!tkwin) { if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("bad screen", -1)); - Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "expected screen distance but got \"%s\"", string)); + Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } return TCL_ERROR; } @@ -729,7 +730,7 @@ TkGetDoublePixels( error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad screen distance \"%s\"", string)); + "expected screen distance but got \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL); } return TCL_ERROR; diff --git a/generic/tkObj.c b/generic/tkObj.c index 68f4acd..e1f58f7 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -517,7 +517,7 @@ SetPixelFromAny( error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad screen distance \"%.50s\"", string)); + "expected screen distance but got \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } return TCL_ERROR; @@ -801,8 +801,8 @@ SetMMFromAny( if (rest == string) { error: Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad screen distance \"%s\"", string)); - Tcl_SetErrorCode(interp, "TK", "VALUE", "DISTANCE", NULL); + "expected screen distance but got \"%s\"", string)); + Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); return TCL_ERROR; } switch (*rest) { diff --git a/generic/tkUtil.c b/generic/tkUtil.c index b4ce9fe..e6f4935 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -494,7 +494,7 @@ TkPixelParseProc( if ((result == TCL_OK) && (clientData == NULL) && (*doublePtr < 0.0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad screen distance \"%s\"", value)); + "expected screen distance but got \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); return TCL_ERROR; } |