summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-11-29 18:16:21 (GMT)
committerhobbs <hobbs>1999-11-29 18:16:21 (GMT)
commitce6f5f2208d6be7e48d3839316116e48fffa64b2 (patch)
treea063c6e2344128c4427109fed49b2316eddbca8f
parent9d2d61aa1a067b49849a53a89bc3d5f815d271ce (diff)
downloadtk-ce6f5f2208d6be7e48d3839316116e48fffa64b2.zip
tk-ce6f5f2208d6be7e48d3839316116e48fffa64b2.tar.gz
tk-ce6f5f2208d6be7e48d3839316116e48fffa64b2.tar.bz2
* generic/tkListbox.c: fixed 'get' of listbox to return a string
when only one item is requested.
-rw-r--r--generic/tkListbox.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 50e7652..fd16994 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkListbox.c,v 1.13 1999/11/24 01:09:07 ericm Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.14 1999/11/29 18:16:21 hobbs Exp $
*/
#include "tkPort.h"
@@ -794,8 +794,15 @@ ListboxWidgetObjCmd(clientData, interp, objc, objv)
if (result != TCL_OK) {
break;
}
- Tcl_SetListObj(Tcl_GetObjResult(interp), (last - first + 1),
- &(elemPtrs[first]));
+ if (objc == 3) {
+ /*
+ * One element request - we return a string
+ */
+ Tcl_SetObjResult(interp, elemPtrs[first]);
+ } else {
+ Tcl_SetListObj(Tcl_GetObjResult(interp), (last - first + 1),
+ &(elemPtrs[first]));
+ }
result = TCL_OK;
break;
}