summaryrefslogtreecommitdiffstats
path: root/generic/tkScale.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-23 13:59:40 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-23 13:59:40 (GMT)
commit571fd220b0be2da05b1a6e8bb32e0b9a447ed288 (patch)
tree46a3064598e4a36c7ca561f9c08f5d22de4b2b9e /generic/tkScale.c
parented7fb54396eee6e5122bfe611b2a14cf422970fa (diff)
downloadtk-571fd220b0be2da05b1a6e8bb32e0b9a447ed288.zip
tk-571fd220b0be2da05b1a6e8bb32e0b9a447ed288.tar.gz
tk-571fd220b0be2da05b1a6e8bb32e0b9a447ed288.tar.bz2
Much more cleaning up of result handling.
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r--generic/tkScale.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 5e577e9..3ca4a67 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -376,6 +376,7 @@ ScaleWidgetObjCmd(
case COMMAND_COORDS: {
int x, y;
double value;
+ Tcl_Obj *coords[2];
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?");
@@ -397,7 +398,9 @@ ScaleWidgetObjCmd(
y = scalePtr->horizTroughY + scalePtr->width/2
+ scalePtr->borderWidth;
}
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d", x, y));
+ coords[0] = Tcl_NewIntObj(x);
+ coords[1] = Tcl_NewIntObj(y);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
}
case COMMAND_GET: {
@@ -421,7 +424,8 @@ ScaleWidgetObjCmd(
break;
}
case COMMAND_IDENTIFY: {
- int x, y, thing;
+ int x, y;
+ const char *zone = "";
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "identify x y");
@@ -431,18 +435,12 @@ ScaleWidgetObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
goto error;
}
- thing = TkpScaleElement(scalePtr, x,y);
- switch (thing) {
- case TROUGH1:
- Tcl_SetResult(interp, "trough1", TCL_STATIC);
- break;
- case SLIDER:
- Tcl_SetResult(interp, "slider", TCL_STATIC);
- break;
- case TROUGH2:
- Tcl_SetResult(interp, "trough2", TCL_STATIC);
- break;
+ switch (TkpScaleElement(scalePtr, x, y)) {
+ case TROUGH1: zone = "trough1"; break;
+ case SLIDER: zone = "slider"; break;
+ case TROUGH2: zone = "trough2"; break;
}
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1));
break;
}
case COMMAND_SET: {