diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/button.tcl | 53 | ||||
-rw-r--r-- | library/entry.tcl | 13 | ||||
-rw-r--r-- | library/listbox.tcl | 10 |
3 files changed, 41 insertions, 35 deletions
diff --git a/library/button.tcl b/library/button.tcl index d70916a..7c33bc2 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -4,7 +4,7 @@ # checkbutton, and radiobutton widgets and provides procedures # that help in implementing those bindings. # -# RCS: @(#) $Id: button.tcl,v 1.4 1999/04/16 01:51:26 stanton Exp $ +# RCS: @(#) $Id: button.tcl,v 1.5 1999/08/09 16:52:06 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -142,10 +142,9 @@ if {[string match "windows" $tcl_platform(platform)]} { proc tkButtonEnter w { global tkPriv - if {[string compare [$w cget -state] "disabled"]} { - if {![string compare $tkPriv(buttonWindow) $w]} { - $w configure -state active -relief sunken - } + if {[string compare [$w cget -state] "disabled"] \ + && ![string compare $tkPriv(buttonWindow) $w]} { + $w configure -state active -relief sunken } set tkPriv(window) $w } @@ -163,7 +162,7 @@ proc tkButtonEnter w { proc tkButtonLeave w { global tkPriv if {[string compare [$w cget -state] "disabled"]} { - $w config -state normal + $w configure -state normal } if {![string compare $tkPriv(buttonWindow) $w]} { $w configure -relief $tkPriv(relief) @@ -182,10 +181,9 @@ proc tkButtonLeave w { proc tkCheckRadioEnter w { global tkPriv - if {[string compare [$w cget -state] "disabled"]} { - if {![string compare $tkPriv(buttonWindow) $w]} { - $w configure -state active - } + if {[string compare [$w cget -state] "disabled"] \ + && ![string compare $tkPriv(buttonWindow) $w]} { + $w configure -state active } set tkPriv(window) $w } @@ -201,10 +199,10 @@ proc tkCheckRadioEnter w { proc tkButtonDown w { global tkPriv - set tkPriv(relief) [lindex [$w conf -relief] 4] + set tkPriv(relief) [$w cget -relief] if {[string compare [$w cget -state] "disabled"]} { set tkPriv(buttonWindow) $w - $w config -relief sunken -state active + $w configure -relief sunken -state active } } @@ -219,10 +217,10 @@ proc tkButtonDown w { proc tkCheckRadioDown w { global tkPriv - set tkPriv(relief) [lindex [$w conf -relief] 4] + set tkPriv(relief) [$w cget -relief] if {[string compare [$w cget -state] "disabled"]} { set tkPriv(buttonWindow) $w - $w config -state active + $w configure -state active } } @@ -238,9 +236,10 @@ proc tkButtonUp w { global tkPriv if {![string compare $tkPriv(buttonWindow) $w]} { set tkPriv(buttonWindow) "" - if {![string compare $tkPriv(window) $w] + $w configure -relief $tkPriv(relief) + if {![string compare $tkPriv(window) $w] && [string compare [$w cget -state] "disabled"]} { - $w config -relief $tkPriv(relief) -state normal + $w configure -state normal uplevel #0 [list $w invoke] } } @@ -265,8 +264,8 @@ if {[string match "unix" $tcl_platform(platform)]} { proc tkButtonEnter {w} { global tkPriv if {[string compare [$w cget -state] "disabled"]} { - $w config -state active - if {![string compare $tkPriv(buttonWindow) $w]} { + $w configure -state active + if {![string compare $tkPriv(buttonWindow) $w]} { $w configure -state active -relief sunken } } @@ -286,7 +285,7 @@ proc tkButtonEnter {w} { proc tkButtonLeave w { global tkPriv if {[string compare [$w cget -state] "disabled"]} { - $w config -state normal + $w configure -state normal } if {![string compare $tkPriv(buttonWindow) $w]} { $w configure -relief $tkPriv(relief) @@ -305,10 +304,10 @@ proc tkButtonLeave w { proc tkButtonDown w { global tkPriv - set tkPriv(relief) [lindex [$w config -relief] 4] + set tkPriv(relief) [$w cget -relief] if {[string compare [$w cget -state] "disabled"]} { set tkPriv(buttonWindow) $w - $w config -relief sunken + $w configure -relief sunken } } @@ -324,9 +323,9 @@ proc tkButtonUp w { global tkPriv if {![string compare $w $tkPriv(buttonWindow)]} { set tkPriv(buttonWindow) "" - $w config -relief $tkPriv(relief) - if {![string compare $w $tkPriv(window)] - && [string compare [$w cget -state] "disabled"]} { + $w configure -relief $tkPriv(relief) + if {![string compare $w $tkPriv(window)] \ + && [string compare [$w cget -state] "disabled"]} { uplevel #0 [list $w invoke] } } @@ -389,7 +388,7 @@ proc tkButtonDown w { global tkPriv if {[string compare [$w cget -state] "disabled"]} { set tkPriv(buttonWindow) $w - $w config -state active + $w configure -state active } } @@ -404,9 +403,9 @@ proc tkButtonDown w { proc tkButtonUp w { global tkPriv if {![string compare $w $tkPriv(buttonWindow)]} { - $w config -state normal + $w configure -state normal set tkPriv(buttonWindow) "" - if {![string compare $w $tkPriv(window)] + if {![string compare $w $tkPriv(window)] && [string compare [$w cget -state] "disabled"]} { uplevel #0 [list $w invoke] } diff --git a/library/entry.tcl b/library/entry.tcl index e7141b1..2bb27c2 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk entry widgets and provides # procedures that help in implementing those bindings. # -# RCS: @(#) $Id: entry.tcl,v 1.6 1999/04/16 01:51:26 stanton Exp $ +# RCS: @(#) $Id: entry.tcl,v 1.7 1999/08/09 16:52:06 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -26,22 +26,25 @@ # char, word, or line. # x, y - Last known mouse coordinates for scanning # and auto-scanning. +# data - Used for Cut and Copy #------------------------------------------------------------------------- #------------------------------------------------------------------------- # The code below creates the default class bindings for entries. #------------------------------------------------------------------------- bind Entry <<Cut>> { - if {![catch {set data [tkEntryGetSelection %W]}]} { + if {![catch {tkEntryGetSelection %W} tkPriv(data)]} { clipboard clear -displayof %W - clipboard append -displayof %W $data + clipboard append -displayof %W $tkPriv(data) %W delete sel.first sel.last + unset tkPriv(data) } } bind Entry <<Copy>> { - if {![catch {set data [tkEntryGetSelection %W]}]} { + if {![catch {tkEntryGetSelection %W} tkPriv(data)]} { clipboard clear -displayof %W - clipboard append -displayof %W $data + clipboard append -displayof %W $tkPriv(data) + unset tkPriv(data) } } bind Entry <<Paste>> { diff --git a/library/listbox.tcl b/library/listbox.tcl index f77ecb3..d273a28 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # -# RCS: @(#) $Id: listbox.tcl,v 1.5 1999/04/16 01:51:26 stanton Exp $ +# RCS: @(#) $Id: listbox.tcl,v 1.6 1999/08/09 16:52:06 hobbs Exp $ # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1995 Sun Microsystems, Inc. @@ -234,10 +234,14 @@ proc tkListboxMotion {w el} { $w selection clear 0 end $w selection set $el set tkPriv(listboxPrev) $el - event generate $w <<ListboxSelect>> + event generate $w <<ListboxSelect>> } extended { set i $tkPriv(listboxPrev) + if {[string equal {} $i]} { + set i $el + $w selection set $el + } if {[$w selection includes anchor]} { $w selection clear $i $el $w selection set anchor $el @@ -258,7 +262,7 @@ proc tkListboxMotion {w el} { incr i -1 } set tkPriv(listboxPrev) $el - event generate $w <<ListboxSelect>> + event generate $w <<ListboxSelect>> } } } |