diff options
Diffstat (limited to 'library/ttk')
-rw-r--r-- | library/ttk/button.tcl | 6 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 4 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 39 |
3 files changed, 37 insertions, 12 deletions
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl index ccc1fb4..494a674 100644 --- a/library/ttk/button.tcl +++ b/library/ttk/button.tcl @@ -1,5 +1,5 @@ # -# $Id: button.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +# $Id: button.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $ # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # @@ -36,8 +36,8 @@ bind TButton <Button1-Enter> \ # Checkbuttons and Radiobuttons have the same bindings as Buttons: # -ttk::CopyBindings TButton TCheckbutton -ttk::CopyBindings TButton TRadiobutton +ttk::copyBindings TButton TCheckbutton +ttk::copyBindings TButton TRadiobutton # ...plus a few more: diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 7df9f61..6c7099c 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -1,5 +1,5 @@ # -# $Id: combobox.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: combobox.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $ # # Ttk widget set: combobox bindings. # @@ -21,7 +21,7 @@ namespace eval ttk::combobox { # Duplicate the Entry bindings, override if needed: # -ttk::CopyBindings TEntry TCombobox +ttk::copyBindings TEntry TCombobox bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W } bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W } diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 11f85b9..8019303 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -1,7 +1,7 @@ # -# $Id: utils.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $ +# $Id: utils.tcl,v 1.3 2006/11/27 06:53:55 jenglish Exp $ # -# Ttk widget set: utilities for widget implementations. +# Utilities for widget implementations. # ### Focus management. @@ -17,6 +17,30 @@ proc ttk::takefocus {w} { expr {[$w instate !disabled] && [winfo viewable $w]} } +# ttk::traverseTo $w -- +# Set the keyboard focus to the specified window. +# +proc ttk::traverseTo {w} { + set focus [focus] + if {$focus ne ""} { + event generate $focus <<TraverseOut>> + } + focus $w + event generate $w <<TraverseIn>> +} + +## ttk::traverseTo $w -- +# Set the keyboard focus to the specified window. +# +proc ttk::traverseTo {w} { + set focus [focus] + if {$focus ne ""} { + event generate $focus <<TraverseOut>> + } + focus $w + event generate $w <<TraverseIn>> +} + ## ttk::clickToFocus $w -- # Utility routine, used in <ButtonPress-1> bindings -- # Assign keyboard focus to the specified widget if -takefocus is enabled. @@ -58,15 +82,16 @@ proc ttk::takesFocus {w} { return 0 } -# ttk::focusFirst $w -- +## ttk::focusFirst $w -- # Return the first descendant of $w, in preorder traversal order, # that can take keyboard focus, "" if none do. # # See also: tk_focusNext # + proc ttk::focusFirst {w} { - if {[ttk::takesFocus $w]} { - return $w + if {[ttk::takesFocus $w]} { + return $w } foreach child [winfo children $w] { if {[set c [ttk::focusFirst $child]] ne ""} { @@ -222,10 +247,10 @@ proc ttk::CancelRepeat {} { ### Miscellaneous. # -## ttk::CopyBindings $from $to -- +## ttk::copyBindings $from $to -- # Utility routine; copies bindings from one bindtag onto another. # -proc ttk::CopyBindings {from to} { +proc ttk::copyBindings {from to} { foreach event [bind $from] { bind $to $event [bind $from $event] } |