summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2003-02-25 02:07:25 (GMT)
committerhobbs <hobbs@noemail.net>2003-02-25 02:07:25 (GMT)
commit51fce6f8464f97d9bb7925b4fcf5fb61abc5a90d (patch)
tree5bbcbe723f2c23a6f4558e3b491027f993b081c8 /generic
parent5a0bed3712a52a7b0e19402c13fcac1e7a4698ff (diff)
downloadtk-51fce6f8464f97d9bb7925b4fcf5fb61abc5a90d.zip
tk-51fce6f8464f97d9bb7925b4fcf5fb61abc5a90d.tar.gz
tk-51fce6f8464f97d9bb7925b4fcf5fb61abc5a90d.tar.bz2
* generic/tkListbox.c (ListboxSelectionSubCmd):
* tests/listbox.test: Allow 'selection includes' to respond when disabled (but only 'includes'). [Bug #632514] FossilOrigin-Name: f0aec0e5cc6ba507c5bfe0875f52ac13f087ede1
Diffstat (limited to 'generic')
-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;
}