diff options
author | hobbs <hobbs> | 2003-02-25 00:46:41 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2003-02-25 00:46:41 (GMT) |
commit | 2390c9d772f3f0f115c35d6e5d4366c21749e637 (patch) | |
tree | 2f84759b83764383bb5b2affa490a72f369f60b6 /generic/tkEntry.c | |
parent | 5719ab8c9c954eb7784bb352ac645fe811a9662b (diff) | |
download | tk-2390c9d772f3f0f115c35d6e5d4366c21749e637.zip tk-2390c9d772f3f0f115c35d6e5d4366c21749e637.tar.gz tk-2390c9d772f3f0f115c35d6e5d4366c21749e637.tar.bz2 |
* generic/tkEntry.c (SpinboxWidgetObjCmd, EntryWidgetObjCmd):
* tests/entry.test: return 1 if selection is present even if
* tests/spinbox.test: entry/spinbox is disabled, as selection get
will still return the selection (although selection still ignore
modify requests when entry/spinbox is disabled). [Bug #637828]
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r-- | generic/tkEntry.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c index de75c2b..3f98ea8 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.34 2003/02/18 21:54:41 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.35 2003/02/25 00:46:41 hobbs Exp $ */ #include "tkInt.h" @@ -1089,14 +1089,16 @@ EntryWidgetObjCmd(clientData, interp, objc, objv) } /* - * Disabled entries don't allow the selection to be modified. + * Disabled entries don't allow the selection to be modified, + * but 'selection present' must return a boolean. */ - if (entryPtr->state == STATE_DISABLED) { + if ((entryPtr->state == STATE_DISABLED) + && (selIndex != SELECTION_PRESENT)) { goto done; } - switch(selIndex) { + switch (selIndex) { case SELECTION_ADJUST: { if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "index"); @@ -1159,11 +1161,8 @@ EntryWidgetObjCmd(clientData, interp, objc, objv) Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL); goto error; } - if (entryPtr->selectFirst < 0) { - Tcl_SetResult(interp, "0", TCL_STATIC); - } else { - Tcl_SetResult(interp, "1", TCL_STATIC); - } + Tcl_SetObjResult(interp, + Tcl_NewBooleanObj((entryPtr->selectFirst >= 0))); goto done; } @@ -4098,14 +4097,16 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv) } /* - * Disabled entries don't allow the selection to be modified. + * Disabled entries don't allow the selection to be modified, + * but 'selection present' must return a boolean. */ - if (entryPtr->state == STATE_DISABLED) { + if ((entryPtr->state == STATE_DISABLED) + && (selIndex != SB_SEL_PRESENT)) { goto done; } - - switch(selIndex) { + + switch (selIndex) { case SB_SEL_ADJUST: { if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "index"); |