diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2001-06-14 10:56:58 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2001-06-14 10:56:58 (GMT) |
commit | cfa85ce7321d315e312a7bb23d4cdf0b2d666f47 (patch) | |
tree | ab207a698a3ec34347d9ed68baa80cb2825a3bd1 /library/demos/cscroll.tcl | |
parent | 019ad61b8b1833368240e189ad1b47b00feaab4c (diff) | |
download | tk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.zip tk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.tar.gz tk-cfa85ce7321d315e312a7bb23d4cdf0b2d666f47.tar.bz2 |
Added braces to expressions.
Diffstat (limited to 'library/demos/cscroll.tcl')
-rw-r--r-- | library/demos/cscroll.tcl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index 0289911..8aad050 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a simple canvas that can be # scrolled in two dimensions. # -# RCS: @(#) $Id: cscroll.tcl,v 1.2 1998/09/14 18:23:27 stanton Exp $ +# RCS: @(#) $Id: cscroll.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." @@ -48,9 +48,9 @@ set bg [lindex [$c config -bg] 4] for {set i 0} {$i < 20} {incr i} { set x [expr {-10 + 3*$i}] for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} { - $c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \ + $c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \ -outline black -fill $bg -tags rect - $c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \ + $c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \ -anchor center -tags text } } @@ -65,14 +65,14 @@ proc scrollEnter canvas { global oldFill set id [$canvas find withtag current] if {[lsearch [$canvas gettags current] text] >= 0} { - set id [expr $id-1] + set id [expr {$id-1}] } set oldFill [lindex [$canvas itemconfig $id -fill] 4] if {[winfo depth $canvas] > 1} { $canvas itemconfigure $id -fill SeaGreen1 } else { $canvas itemconfigure $id -fill black - $canvas itemconfigure [expr $id+1] -fill white + $canvas itemconfigure [expr {$id+1}] -fill white } } @@ -80,17 +80,17 @@ proc scrollLeave canvas { global oldFill set id [$canvas find withtag current] if {[lsearch [$canvas gettags current] text] >= 0} { - set id [expr $id-1] + set id [expr {$id-1}] } $canvas itemconfigure $id -fill $oldFill - $canvas itemconfigure [expr $id+1] -fill black + $canvas itemconfigure [expr {$id+1}] -fill black } proc scrollButton canvas { global oldFill set id [$canvas find withtag current] if {[lsearch [$canvas gettags current] text] < 0} { - set id [expr $id+1] + set id [expr {$id+1}] } puts stdout "You buttoned at [lindex [$canvas itemconf $id -text] 4]" } |