diff options
author | hobbs <hobbs> | 2003-02-25 02:07:25 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2003-02-25 02:07:25 (GMT) |
commit | 4caaf0b026ae5220a24b2d227af368c5d9950f7d (patch) | |
tree | 5bbcbe723f2c23a6f4558e3b491027f993b081c8 /generic | |
parent | c772cdb1ee05f9f47db3f1ed0f6f6d4009e5f727 (diff) | |
download | tk-4caaf0b026ae5220a24b2d227af368c5d9950f7d.zip tk-4caaf0b026ae5220a24b2d227af368c5d9950f7d.tar.gz tk-4caaf0b026ae5220a24b2d227af368c5d9950f7d.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')
-rw-r--r-- | generic/tkListbox.c | 26 |
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; } |