summaryrefslogtreecommitdiffstats
path: root/library/tk.tcl
diff options
context:
space:
mode:
authorjenglish <jenglish@noemail.net>2004-10-19 18:56:00 (GMT)
committerjenglish <jenglish@noemail.net>2004-10-19 18:56:00 (GMT)
commit4bc98b28723edc2e238fec85b5825c94c2f345a8 (patch)
treee271148869cd9d31a55ab0cf4d581b1b34e00d21 /library/tk.tcl
parentaa7927bfdbefb2b498e8a267a840b88fb3239947 (diff)
downloadtk-4bc98b28723edc2e238fec85b5825c94c2f345a8.zip
tk-4bc98b28723edc2e238fec85b5825c94c2f345a8.tar.gz
tk-4bc98b28723edc2e238fec85b5825c94c2f345a8.tar.bz2
TIP #204 "Virtual Events for Keyboard Traversal" (patch #976928)
FossilOrigin-Name: 50bf19de6f62a638e0611a2b0e82bc676d080c8f
Diffstat (limited to 'library/tk.tcl')
-rw-r--r--library/tk.tcl16
1 files changed, 9 insertions, 7 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index 9daeb69..995083d 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,7 +3,7 @@
# Initialization script normally executed in the interpreter for each
# Tk-based application. Arranges class bindings for widgets.
#
-# RCS: @(#) $Id: tk.tcl,v 1.53 2004/03/17 18:15:45 das Exp $
+# RCS: @(#) $Id: tk.tcl,v 1.54 2004/10/19 18:56:01 jenglish Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -428,19 +428,21 @@ proc ::tk::CancelRepeat {} {
}
# ::tk::TabToWindow --
-# This procedure moves the focus to the given widget. If the widget
-# is an entry or a spinbox, it selects the entire contents of the widget.
+# This procedure moves the focus to the given widget.
+# It sends a <<TraverseOut>> virtual event to the previous focus window,
+# if any, before changing the focus, and a <<TraverseIn>> event
+# to the new focus window afterwards.
#
# Arguments:
# w - Window to which focus should be set.
proc ::tk::TabToWindow {w} {
- if {[string equal [winfo class $w] Entry] \
- || [string equal [winfo class $w] Spinbox]} {
- $w selection range 0 end
- $w icursor end
+ set focus [focus]
+ if {$focus ne ""} {
+ event generate $focus <<TraverseOut>>
}
focus $w
+ event generate $w <<TraverseIn>>
}
# ::tk::UnderlineAmpersand --