diff options
author | hobbs <hobbs> | 2003-02-25 00:46:41 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2003-02-25 00:46:41 (GMT) |
commit | da8f7877e119679ac2654359c1053e9947b01938 (patch) | |
tree | 2f84759b83764383bb5b2affa490a72f369f60b6 /generic/tkEntry.c | |
parent | 68b02413629ab3ebad8f39d83c6fac20319f6f08 (diff) | |
download | tk-da8f7877e119679ac2654359c1053e9947b01938.zip tk-da8f7877e119679ac2654359c1053e9947b01938.tar.gz tk-da8f7877e119679ac2654359c1053e9947b01938.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"); |