summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-10-31 16:37:22 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-10-31 16:37:22 (GMT)
commit18a280346bfde55de803ecbbfe01144364e2b0ef (patch)
tree77249e34b807f89065157da4f9814e1ee7b64121
parenta0bcf50401b6824925838b8ce781d72ba993caf9 (diff)
downloadtk-18a280346bfde55de803ecbbfe01144364e2b0ef.zip
tk-18a280346bfde55de803ecbbfe01144364e2b0ef.tar.gz
tk-18a280346bfde55de803ecbbfe01144364e2b0ef.tar.bz2
Improved description/comments so that people better understand what is being
validated, following suggestion from Don Porter.
-rw-r--r--ChangeLog4
-rw-r--r--library/demos/entry3.tcl6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bddda72..c87ece5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-10-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * library/demos/entry3.tcl: Improved description/comments so that
+ people better understand what is being validated, following suggestion
+ from Don Porter.
+
* library/demos/image2.tcl (loadImage): Mark non-loadable images
as such instead of throwing a nasty dialog, following suggestion
from Don Porter.
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index c8dd1ab..bc30745 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -4,7 +4,7 @@
# permitted input is constrained in some way. It also shows off a
# password entry.
#
-# RCS: @(#) $Id: entry3.tcl,v 1.5 2007/10/17 18:55:05 das Exp $
+# RCS: @(#) $Id: entry3.tcl,v 1.6 2007/10/31 16:37:23 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -22,7 +22,7 @@ positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "Four different\
entries are displayed below. You can add characters by pointing,\
clicking and typing, though each is constrained in what it will\
- accept. The first only accepts integers or the empty string\
+ accept. The first only accepts 32-bit integers or the empty string\
(checking when focus leaves it) and will flash to indicate any\
problem. The second only accepts strings with fewer than ten\
characters and sounds the bell when an attempt to go over the limit\
@@ -64,6 +64,8 @@ proc focusAndFlash {W fg bg {count 9}} {
}
labelframe $w.l1 -text "Integer Entry"
+# Alternatively try using {string is digit} for arbitrary length numbers,
+# and not just 32-bit ones.
entry $w.l1.e -validate focus -vcmd {string is integer %P}
$w.l1.e configure -invalidcommand \
"focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]"