summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-25 00:46:41 (GMT)
committerhobbs <hobbs>2003-02-25 00:46:41 (GMT)
commitda8f7877e119679ac2654359c1053e9947b01938 (patch)
tree2f84759b83764383bb5b2affa490a72f369f60b6
parent68b02413629ab3ebad8f39d83c6fac20319f6f08 (diff)
downloadtk-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]
-rw-r--r--ChangeLog8
-rw-r--r--generic/tkEntry.c27
-rw-r--r--tests/entry.test18
-rw-r--r--tests/spinbox.test16
4 files changed, 54 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index e963580..8207760 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * 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]
+
2003-02-24 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
* tkMacOSXDialog.c (NavServicesGetFile): Fix bug with
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");
diff --git a/tests/entry.test b/tests/entry.test
index effa631..101a0c6 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: entry.test,v 1.13 2002/10/02 20:59:28 hobbs Exp $
+# RCS: @(#) $Id: entry.test,v 1.14 2003/02/25 00:46:41 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -1599,6 +1599,22 @@ test entry-20.7 {widget deletion with textvariable active} {
winfo exists .e
} 0
+test entry-21.1 {selection present while disabled, bug 637828} {
+ destroy .e
+ entry .e
+ .e insert end 0123456789
+ .e select from 3
+ .e select to 6
+ set out [.e selection present]
+ .e configure -state disabled
+ # still return 1 when disabled, because 'selection get' will work,
+ # but selection cannot be changed (new behavior since 8.4)
+ .e select to 9
+ lappend out [.e selection present] [selection get]
+} {1 1 345}
+
+destroy .e
+
# XXX Still need to write tests for EntryBlinkProc, EntryFocusProc,
# and EntryTextVarProc.
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 74c81a6..5881087 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -4,7 +4,7 @@
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: spinbox.test,v 1.4 2002/07/25 21:19:01 hobbs Exp $
+# RCS: @(#) $Id: spinbox.test,v 1.5 2003/02/25 00:46:41 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -1572,6 +1572,20 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} {
set val
} {6}
+test entry-23.1 {selection present while disabled, bug 637828} {
+ destroy .e
+ entry .e
+ .e insert end 0123456789
+ .e select from 3
+ .e select to 6
+ set out [.e selection present]
+ .e configure -state disabled
+ # still return 1 when disabled, because 'selection get' will work,
+ # but selection cannot be changed (new behavior since 8.4)
+ .e select to 9
+ lappend out [.e selection present] [selection get]
+} {1 1 345}
+
destroy .e
catch {unset ::e ::vVals}