summaryrefslogtreecommitdiffstats
path: root/library/demos/twind.tcl
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2001-06-14 10:56:58 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2001-06-14 10:56:58 (GMT)
commitcfa85ce7321d315e312a7bb23d4cdf0b2d666f47 (patch)
treeab207a698a3ec34347d9ed68baa80cb2825a3bd1 /library/demos/twind.tcl
parent019ad61b8b1833368240e189ad1b47b00feaab4c (diff)
downloadtk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.zip
tk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.tar.gz
tk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.tar.bz2
Added braces to expressions.
Diffstat (limited to 'library/demos/twind.tcl')
-rw-r--r--library/demos/twind.tcl21
1 files changed, 11 insertions, 10 deletions
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl
index bdb8337..8dff2dd 100644
--- a/library/demos/twind.tcl
+++ b/library/demos/twind.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a text widget with a bunch of
# embedded windows.
#
-# RCS: @(#) $Id: twind.tcl,v 1.2 1998/09/14 18:23:30 stanton Exp $
+# RCS: @(#) $Id: twind.tcl,v 1.3 2001/06/14 10:56:58 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -115,7 +115,7 @@ proc textWindOff w {
proc textWindPlot t {
set c $t.c
- if [winfo exists $c] {
+ if {[winfo exists $c]} {
return
}
canvas $c -relief sunken -width 450 -height 300 -cursor top_left_arrow
@@ -129,20 +129,21 @@ proc textWindPlot t {
for {set i 0} {$i <= 10} {incr i} {
set x [expr {100 + ($i*30)}]
$c create line $x 250 $x 245 -width 2
- $c create text $x 254 -text [expr 10*$i] -anchor n -font $font
+ $c create text $x 254 -text [expr {10*$i}] -anchor n -font $font
}
for {set i 0} {$i <= 5} {incr i} {
set y [expr {250 - ($i*40)}]
$c create line 100 $y 105 $y -width 2
- $c create text 96 $y -text [expr $i*50].0 -anchor e -font $font
+ $c create text 96 $y -text [expr {$i*50}].0 -anchor e -font $font
}
- foreach point {{12 56} {20 94} {33 98} {32 120} {61 180}
- {75 160} {98 223}} {
+ foreach point {
+ {12 56} {20 94} {33 98} {32 120} {61 180} {75 160} {98 223}
+ } {
set x [expr {100 + (3*[lindex $point 0])}]
set y [expr {250 - (4*[lindex $point 1])/5}]
- set item [$c create oval [expr $x-6] [expr $y-6] \
- [expr $x+6] [expr $y+6] -width 1 -outline black \
+ set item [$c create oval [expr {$x-6}] [expr {$y-6}] \
+ [expr {$x+6}] [expr {$y+6}] -width 1 -outline black \
-fill SkyBlue2]
$c addtag point withtag $item
}
@@ -175,14 +176,14 @@ proc embPlotDown {w x y} {
proc embPlotMove {w x y} {
global embPlot
- $w move selected [expr $x-$embPlot(lastX)] [expr $y-$embPlot(lastY)]
+ $w move selected [expr {$x-$embPlot(lastX)}] [expr {$y-$embPlot(lastY)}]
set embPlot(lastX) $x
set embPlot(lastY) $y
}
proc textWindDel w {
set t $w.f.text
- if [winfo exists $t.c] {
+ if {[winfo exists $t.c]} {
$t delete $t.c
while {[string first [$t get plot] " \t\n"] >= 0} {
$t delete plot