summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-25 02:07:25 (GMT)
committerhobbs <hobbs>2003-02-25 02:07:25 (GMT)
commitd665260f8de4cab05575ab6784d8bc4f62a0cd54 (patch)
tree5bbcbe723f2c23a6f4558e3b491027f993b081c8 /generic/tkListbox.c
parent3cbdddcb83366ade6f30adef2061fcfb28acdb55 (diff)
downloadtk-d665260f8de4cab05575ab6784d8bc4f62a0cd54.zip
tk-d665260f8de4cab05575ab6784d8bc4f62a0cd54.tar.gz
tk-d665260f8de4cab05575ab6784d8bc4f62a0cd54.tar.bz2
* generic/tkListbox.c (ListboxSelectionSubCmd):
* tests/listbox.test: Allow 'selection includes' to respond when disabled (but only 'includes'). [Bug #632514]
Diffstat (limited to 'generic/tkListbox.c')
-rw-r--r--generic/tkListbox.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index d11396f..78977d6 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.28 2002/08/05 04:30:39 dgp Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.29 2003/02/25 02:07:25 hobbs Exp $
*/
#include "tkPort.h"
@@ -1042,14 +1042,10 @@ ListboxWidgetObjCmd(clientData, interp, objc, objv)
}
case COMMAND_SELECTION: {
- if (!(listPtr->state & STATE_NORMAL)) {
- break;
- }
-
result = ListboxSelectionSubCmd(interp, listPtr, objc, objv);
break;
}
-
+
case COMMAND_SIZE: {
char buf[TCL_INTEGER_SPACE];
if (objc != 2) {
@@ -1182,6 +1178,16 @@ ListboxSelectionSubCmd(interp, listPtr, objc, objv)
if (result != TCL_OK) {
return result;
}
+
+ /*
+ * Only allow 'selection includes' to respond if disabled. [Bug #632514]
+ */
+
+ if ((listPtr->state == STATE_DISABLED)
+ && (selCmdIndex != SELECTION_INCLUDES)) {
+ return TCL_OK;
+ }
+
switch (selCmdIndex) {
case SELECTION_ANCHOR: {
if (objc != 4) {
@@ -1207,11 +1213,9 @@ ListboxSelectionSubCmd(interp, listPtr, objc, objv)
Tcl_WrongNumArgs(interp, 3, objv, "index");
return TCL_ERROR;
}
- if (Tcl_FindHashEntry(listPtr->selection, (char *)first)) {
- Tcl_SetResult(interp, "1", TCL_STATIC);
- } else {
- Tcl_SetResult(interp, "0", TCL_STATIC);
- }
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj((Tcl_FindHashEntry(listPtr->selection,
+ (char *)first) != NULL)));
result = TCL_OK;
break;
}