summaryrefslogtreecommitdiffstats
path: root/library/scale.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/scale.tcl')
-rw-r--r--library/scale.tcl32
1 files changed, 16 insertions, 16 deletions
diff --git a/library/scale.tcl b/library/scale.tcl
index a761a01..e36dbe8 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk scale widgets and provides
# procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: scale.tcl,v 1.3 1998/09/14 18:23:24 stanton Exp $
+# RCS: @(#) $Id: scale.tcl,v 1.4 1999/04/16 01:51:27 stanton Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
@@ -32,7 +32,7 @@ bind Scale <Leave> {
if {$tk_strictMotif} {
%W config -activebackground $tkPriv(activeBg)
}
- if {[%W cget -state] == "active"} {
+ if {![string compare [%W cget -state] "active"]} {
%W configure -state normal
}
}
@@ -107,10 +107,10 @@ bind Scale <End> {
proc tkScaleActivate {w x y} {
global tkPriv
- if {[$w cget -state] == "disabled"} {
- return;
+ if {![string compare [$w cget -state] "disabled"]} {
+ return
}
- if {[$w identify $x $y] == "slider"} {
+ if {![string compare [$w identify $x $y] "slider"]} {
$w configure -state active
} else {
$w configure -state normal
@@ -129,11 +129,11 @@ proc tkScaleButtonDown {w x y} {
global tkPriv
set tkPriv(dragging) 0
set el [$w identify $x $y]
- if {$el == "trough1"} {
+ if {![string compare $el "trough1"]} {
tkScaleIncrement $w up little initial
- } elseif {$el == "trough2"} {
+ } elseif {![string compare $el "trough2"]} {
tkScaleIncrement $w down little initial
- } elseif {$el == "slider"} {
+ } elseif {![string compare $el "slider"]} {
set tkPriv(dragging) 1
set tkPriv(initValue) [$w get]
set coords [$w coords]
@@ -194,7 +194,7 @@ proc tkScaleEndDrag {w} {
proc tkScaleIncrement {w dir big repeat} {
global tkPriv
if {![winfo exists $w]} return
- if {$big == "big"} {
+ if {![string compare $big "big"]} {
set inc [$w cget -bigincrement]
if {$inc == 0} {
set inc [expr {abs([$w cget -to] - [$w cget -from])/10.0}]
@@ -205,15 +205,15 @@ proc tkScaleIncrement {w dir big repeat} {
} else {
set inc [$w cget -resolution]
}
- if {([$w cget -from] > [$w cget -to]) ^ ($dir == "up")} {
+ if {([$w cget -from] > [$w cget -to]) ^ ![string compare $dir "up"]} {
set inc [expr {-$inc}]
}
$w set [expr {[$w get] + $inc}]
- if {$repeat == "again"} {
+ if {![string compare $repeat "again"]} {
set tkPriv(afterId) [after [$w cget -repeatinterval] \
tkScaleIncrement $w $dir $big again]
- } elseif {$repeat == "initial"} {
+ } elseif {![string compare $repeat "initial"]} {
set delay [$w cget -repeatdelay]
if {$delay > 0} {
set tkPriv(afterId) [after $delay \
@@ -233,9 +233,9 @@ proc tkScaleIncrement {w dir big repeat} {
proc tkScaleControlPress {w x y} {
set el [$w identify $x $y]
- if {$el == "trough1"} {
+ if {![string compare $el "trough1"]} {
$w set [$w cget -from]
- } elseif {$el == "trough2"} {
+ } elseif {![string compare $el "trough2"]} {
$w set [$w cget -to]
}
}
@@ -252,8 +252,8 @@ proc tkScaleControlPress {w x y} {
proc tkScaleButton2Down {w x y} {
global tkPriv
- if {[$w cget -state] == "disabled"} {
- return;
+ if {![string compare [$w cget -state] "disabled"]} {
+ return
}
$w configure -state active
$w set [$w get $x $y]