--- c++tk/tk.tcl.orig Thu Sep 25 03:43:23 1997 +++ c++tk/tk.tcl Mon May 3 23:16:51 1999 @@ -3,7 +3,7 @@ # Initialization script normally executed in the interpreter for each # Tk-based application. Arranges class bindings for widgets. # -# SCCS: @(#) tk.tcl 1.87 96/09/30 09:28:02 +# RCS: @(#) $Id: patch-1,v 1.1 1999/05/03 22:49:45 jmz Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -13,8 +13,8 @@ # Insist on running with compatible versions of Tcl and Tk. -package require -exact Tk 4.2 -package require -exact Tcl 7.6 +package require -exact Tk 8.2 +package require -exact Tcl 8.2 # Turn off strict Motif look and feel as a default. @@ -32,13 +32,23 @@ # screen - The name of the new screen. proc tkScreenChanged screen { - set disp [file rootname $screen] + set x [string last . $screen] + if {$x > 0} { + set disp [string range $screen 0 [expr {$x - 1}]] + } else { + set disp $screen + } + uplevel #0 upvar #0 tkPriv.$disp tkPriv global tkPriv - if [info exists tkPriv] { + global tcl_platform + + if {[info exists tkPriv]} { set tkPriv(screen) $screen return } + set tkPriv(activeMenu) {} + set tkPriv(activeItem) {} set tkPriv(afterId) {} set tkPriv(buttons) 0 set tkPriv(buttonWindow) {} @@ -48,14 +58,17 @@ set tkPriv(initPos) {} set tkPriv(inMenubutton) {} set tkPriv(listboxPrev) {} + set tkPriv(menuBar) {} set tkPriv(mouseMoved) 0 set tkPriv(oldGrab) {} set tkPriv(popup) {} set tkPriv(postedMb) {} set tkPriv(pressX) 0 set tkPriv(pressY) 0 + set tkPriv(prevPos) 0 set tkPriv(screen) $screen set tkPriv(selectMode) char + set tkPriv(tearoff) 1 set tkPriv(window) {} } @@ -76,7 +89,7 @@ proc tkEventMotifBindings {n1 dummy dummy} { upvar $n1 name - if $name { + if {$name} { set op delete } else { set op add @@ -94,15 +107,17 @@ event add <> event add <> event add <> + event add <> trace variable tk_strictMotif w tkEventMotifBindings set tk_strictMotif $tk_strictMotif + # ---------------------------------------------------------------------- # Default bindings for keyboard traversal. # ---------------------------------------------------------------------- -bind all {focus [tk_focusNext %W]} -bind all {focus [tk_focusPrev %W]} +bind all {tkTabToWindow [tk_focusNext %W]} +bind all {tkTabToWindow [tk_focusPrev %W]} # tkCancelRepeat -- # This procedure is invoked to cancel an auto-repeat action described @@ -117,4 +132,19 @@ global tkPriv after cancel $tkPriv(afterId) set tkPriv(afterId) {} +} + +# tkTabToWindow -- +# This procedure moves the focus to the given widget. If the widget +# is an entry, it selects the entire contents of the widget. +# +# Arguments: +# w - Window to which focus should be set. + +proc tkTabToWindow {w} { + if {"[winfo class $w]" == "Entry"} { + $w select range 0 end + $w icur end + } + focus $w }