summaryrefslogtreecommitdiffstats
path: root/library/focus.tcl
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 01:51:06 (GMT)
committerstanton <stanton>1999-04-16 01:51:06 (GMT)
commit03656f44f81469f459031fa3a4a7b09c8bc77712 (patch)
tree31378e81bd58f8c726fc552d6b30cbf3ca07497b /library/focus.tcl
parent404fc236f34304df53b7e44bc7971d786b87d453 (diff)
downloadtk-03656f44f81469f459031fa3a4a7b09c8bc77712.zip
tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.gz
tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.bz2
* Merged 8.1 branch into the main trunk
Diffstat (limited to 'library/focus.tcl')
-rw-r--r--library/focus.tcl35
1 files changed, 18 insertions, 17 deletions
diff --git a/library/focus.tcl b/library/focus.tcl
index 276d518..5ece432 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -3,7 +3,7 @@
# This file defines several procedures for managing the input
# focus.
#
-# RCS: @(#) $Id: focus.tcl,v 1.3 1998/09/14 18:23:23 stanton Exp $
+# RCS: @(#) $Id: focus.tcl,v 1.4 1999/04/16 01:51:26 stanton Exp $
#
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
#
@@ -38,7 +38,7 @@ proc tk_focusNext w {
incr i
if {$i < [llength $children]} {
set cur [lindex $children $i]
- if {[winfo toplevel $cur] == $cur} {
+ if {![string compare [winfo toplevel $cur] $cur]} {
continue
} else {
break
@@ -50,14 +50,14 @@ proc tk_focusNext w {
# look for its next sibling.
set cur $parent
- if {[winfo toplevel $cur] == $cur} {
+ if {![string compare [winfo toplevel $cur] $cur]} {
break
}
set parent [winfo parent $parent]
set children [winfo children $parent]
set i [lsearch -exact $children $cur]
}
- if {($cur == $w) || [tkFocusOK $cur]} {
+ if {![string compare $w $cur] || [tkFocusOK $cur]} {
return $cur
}
}
@@ -81,8 +81,8 @@ proc tk_focusPrev w {
# Collect information about the current window's position
# among its siblings. Also, if the window is a top-level,
# then reposition to just after the last child of the window.
-
- if {[winfo toplevel $cur] == $cur} {
+
+ if {![string compare [winfo toplevel $cur] $cur]} {
set parent $cur
set children [winfo children $cur]
set i [llength $children]
@@ -100,7 +100,7 @@ proc tk_focusPrev w {
while {$i > 0} {
incr i -1
set cur [lindex $children $i]
- if {[winfo toplevel $cur] == $cur} {
+ if {![string compare [winfo toplevel $cur] $cur]} {
continue
}
set parent $cur
@@ -108,7 +108,7 @@ proc tk_focusPrev w {
set i [llength $children]
}
set cur $parent
- if {($cur == $w) || [tkFocusOK $cur]} {
+ if {![string compare $w $cur] || [tkFocusOK $cur]} {
return $cur
}
}
@@ -130,14 +130,14 @@ proc tk_focusPrev w {
proc tkFocusOK w {
set code [catch {$w cget -takefocus} value]
- if {($code == 0) && ($value != "")} {
+ if {($code == 0) && [string compare $value ""]} {
if {$value == 0} {
return 0
} elseif {$value == 1} {
return [winfo viewable $w]
} else {
set value [uplevel #0 $value $w]
- if {$value != ""} {
+ if {[string compare $value ""]} {
return $value
}
}
@@ -146,7 +146,7 @@ proc tkFocusOK w {
return 0
}
set code [catch {$w cget -state} value]
- if {($code == 0) && ($value == "disabled")} {
+ if {($code == 0) && ![string compare $value "disabled"]} {
return 0
}
regexp Key|Focus "[bind $w] [bind [winfo class $w]]"
@@ -165,14 +165,15 @@ proc tkFocusOK w {
proc tk_focusFollowsMouse {} {
set old [bind all <Enter>]
set script {
- if {("%d" == "NotifyAncestor") || ("%d" == "NotifyNonlinear")
- || ("%d" == "NotifyInferior")} {
- if {[tkFocusOK %W]} {
- focus %W
- }
+ if {![string compare "%d" "NotifyAncestor"]
+ || ![string compare "%d" "NotifyNonlinear"]
+ || ![string compare "%d" "NotifyInferior"]} {
+ if {[tkFocusOK %W]} {
+ focus %W
+ }
}
}
- if {$old != ""} {
+ if {[string compare $old ""]} {
bind all <Enter> "$old; $script"
} else {
bind all <Enter> $script