From 37ceb5fe2eba6473a2fbdb5407e449ef96345a43 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Aug 2012 14:59:12 +0000 Subject: 8 new virtual events (doc not updated yet) --- library/demos/items.tcl | 2 +- library/entry.tcl | 14 ++------------ library/iconlist.tcl | 4 ++-- library/listbox.tcl | 8 ++++---- library/menu.tcl | 4 ++-- library/scale.tcl | 8 ++++---- library/scrlbar.tcl | 8 ++++---- library/spinbox.tcl | 14 ++------------ library/text.tcl | 48 ++++++++---------------------------------------- library/tk.tcl | 28 ++++++++++++++++++++++++++++ library/ttk/entry.tcl | 4 ++-- library/ttk/scale.tcl | 8 ++++---- 12 files changed, 63 insertions(+), 87 deletions(-) diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 31a1570..177e9a4 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -173,7 +173,7 @@ bind $c <2> "$c scan mark %x %y" bind $c "$c scan dragto %x %y" bind $c <3> "itemMark $c %x %y" bind $c "itemStroke $c %x %y" -bind $c "itemsUnderArea $c" +bind $c <> "itemsUnderArea $c" bind $c <1> "itemStartDrag $c %x %y" bind $c "itemDrag $c %x %y" diff --git a/library/entry.tcl b/library/entry.tcl index 5dbf063..026363c 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -214,8 +214,8 @@ if {[tk windowingsystem] eq "aqua"} { bind Entry {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] -bind Entry {# nothing} -bind Entry {# nothing} +bind Entry <> {# nothing} +bind Entry <> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <> event, so we don't need to do anything here. @@ -227,21 +227,11 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Entry { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W [expr {[%W index insert] - 1}] - } -} bind Entry { if {!$tk_strictMotif} { %W delete insert } } -bind Entry { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W [expr {[%W index insert] + 1}] - } -} bind Entry { if {!$tk_strictMotif} { tk::EntryBackspace %W diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 15a4f53..ce1aae2 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -444,8 +444,8 @@ package require Tk 8.6 bind $canvas {;} bind $canvas [namespace code {my ShiftMotion1 %x %y}] - bind $canvas [namespace code {my UpDown -1}] - bind $canvas [namespace code {my UpDown 1}] + bind $canvas <> [namespace code {my UpDown -1}] + bind $canvas <> [namespace code {my UpDown 1}] bind $canvas <> [namespace code {my LeftRight -1}] bind $canvas <> [namespace code {my LeftRight 1}] bind $canvas [namespace code {my ReturnKey}] diff --git a/library/listbox.tcl b/library/listbox.tcl index eae513a..2715385 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -69,16 +69,16 @@ bind Listbox { tk::CancelRepeat } -bind Listbox { +bind Listbox <> { tk::ListboxUpDown %W -1 } -bind Listbox { +bind Listbox <> { tk::ListboxExtendUpDown %W -1 } -bind Listbox { +bind Listbox <> { tk::ListboxUpDown %W 1 } -bind Listbox { +bind Listbox <> { tk::ListboxExtendUpDown %W 1 } bind Listbox <> { diff --git a/library/menu.tcl b/library/menu.tcl index 8261e82..a51c96f 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -155,10 +155,10 @@ bind Menu <> { bind Menu <> { tk::MenuRightArrow %W } -bind Menu { +bind Menu <> { tk::MenuUpArrow %W } -bind Menu { +bind Menu <> { tk::MenuDownArrow %W } bind Menu { diff --git a/library/scale.tcl b/library/scale.tcl index 72a254a..d9e7d27 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -71,10 +71,10 @@ if {[tk windowingsystem] eq "win32"} { bind Scale { tk::ScaleControlPress %W %x %y } -bind Scale { +bind Scale <> { tk::ScaleIncrement %W up little noRepeat } -bind Scale { +bind Scale <> { tk::ScaleIncrement %W down little noRepeat } bind Scale <> { @@ -83,10 +83,10 @@ bind Scale <> { bind Scale <> { tk::ScaleIncrement %W down little noRepeat } -bind Scale { +bind Scale <> { tk::ScaleIncrement %W up big noRepeat } -bind Scale { +bind Scale <> { tk::ScaleIncrement %W down big noRepeat } bind Scale <> { diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 4a16f0b..1f8c7d2 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -91,16 +91,16 @@ bind Scrollbar { tk::ScrollTopBottom %W %x %y } -bind Scrollbar { +bind Scrollbar <> { tk::ScrollByUnits %W v -1 } -bind Scrollbar { +bind Scrollbar <> { tk::ScrollByUnits %W v 1 } -bind Scrollbar { +bind Scrollbar <> { tk::ScrollByPages %W v -1 } -bind Scrollbar { +bind Scrollbar <> { tk::ScrollByPages %W v 1 } bind Scrollbar <> { diff --git a/library/spinbox.tcl b/library/spinbox.tcl index d5b4d79..54d8fe6 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -120,10 +120,10 @@ bind Spinbox { %W icursor @%x } -bind Spinbox { +bind Spinbox <> { %W invoke buttonup } -bind Spinbox { +bind Spinbox <> { %W invoke buttondown } @@ -231,21 +231,11 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Spinbox { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W [expr {[%W index insert] - 1}] - } -} bind Spinbox { if {!$tk_strictMotif} { %W delete insert } } -bind Spinbox { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W [expr {[%W index insert] + 1}] - } -} bind Spinbox { if {!$tk_strictMotif} { ::tk::EntryBackspace %W diff --git a/library/text.tcl b/library/text.tcl index a71150a..94bb223 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -92,10 +92,10 @@ bind Text <> { bind Text <> { tk::TextSetCursor %W insert+1displayindices } -bind Text { +bind Text <> { tk::TextSetCursor %W [tk::TextUpDownLine %W -1] } -bind Text { +bind Text <> { tk::TextSetCursor %W [tk::TextUpDownLine %W 1] } bind Text <> { @@ -104,10 +104,10 @@ bind Text <> { bind Text <> { tk::TextKeySelect %W [%W index {insert + 1displayindices}] } -bind Text { +bind Text <> { tk::TextKeySelect %W [tk::TextUpDownLine %W -1] } -bind Text { +bind Text <> { tk::TextKeySelect %W [tk::TextUpDownLine %W 1] } bind Text <> { @@ -116,10 +116,10 @@ bind Text <> { bind Text <> { tk::TextSetCursor %W [tk::TextNextWord %W insert] } -bind Text { +bind Text <> { tk::TextSetCursor %W [tk::TextPrevPara %W insert] } -bind Text { +bind Text <> { tk::TextSetCursor %W [tk::TextNextPara %W insert] } bind Text <> { @@ -128,10 +128,10 @@ bind Text <> { bind Text <> { tk::TextKeySelect %W [tk::TextNextWord %W insert] } -bind Text { +bind Text <> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } -bind Text { +bind Text <> { tk::TextKeySelect %W [tk::TextNextPara %W insert] } bind Text { @@ -287,21 +287,11 @@ if {[tk windowingsystem] eq "aqua"} { # Additional emacs-like bindings: -bind Text { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert-1displayindices - } -} bind Text { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } } -bind Text { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert+1displayindices - } -} bind Text { if {!$tk_strictMotif && [%W compare end != insert+1c]} { if {[%W compare insert == {insert lineend}]} { @@ -311,22 +301,12 @@ bind Text { } } } -bind Text { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W 1] - } -} bind Text { if {!$tk_strictMotif} { %W insert insert \n %W mark set insert insert-1c } } -bind Text { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W -1] - } -} bind Text { if {!$tk_strictMotif} { tk::TextTranspose %W @@ -380,18 +360,6 @@ bind Text { # Macintosh only bindings: if {[tk windowingsystem] eq "aqua"} { -bind Text { - tk::TextSetCursor %W [tk::TextPrevPara %W insert] -} -bind Text { - tk::TextSetCursor %W [tk::TextNextPara %W insert] -} -bind Text { - tk::TextKeySelect %W [tk::TextPrevPara %W insert] -} -bind Text { - tk::TextKeySelect %W [tk::TextNextPara %W insert] -} bind Text <> { tk::TextScrollPages %W 1 } diff --git a/library/tk.tcl b/library/tk.tcl index 33671ed..b810dc6 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -311,6 +311,10 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} { event $op <> event $op <> event $op <> + event $op <> + event $op <> + event $op <> + event $op <> } #---------------------------------------------------------------------- @@ -381,6 +385,14 @@ switch -exact -- [tk windowingsystem] { event add <> event add <> event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> # Some OS's define a goofy (as in, not ) keysym that is # returned when the user presses . In order for tab @@ -422,6 +434,14 @@ switch -exact -- [tk windowingsystem] { event add <> event add <> event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> } "aqua" { event add <> @@ -449,6 +469,14 @@ switch -exact -- [tk windowingsystem] { # bindings present in MS Word on OSX. event add <> event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> } } diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 9e0d6e1..dc835e9 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -136,8 +136,8 @@ if {[tk windowingsystem] eq "aqua"} { bind TEntry {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] -bind TEntry {# nothing} -bind TEntry {# nothing} +bind TEntry <> {# nothing} +bind TEntry <> {# nothing} ## Additional emacs-like bindings: # diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index f270697..69b9dd8 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -27,13 +27,13 @@ bind TScale <> { %W set [%W cget -from] } bind TScale <> { %W set [%W cget -to] } bind TScale <> { ttk::scale::Increment %W -1 } -bind TScale { ttk::scale::Increment %W -1 } +bind TScale <> { ttk::scale::Increment %W -1 } bind TScale <> { ttk::scale::Increment %W 1 } -bind TScale { ttk::scale::Increment %W 1 } +bind TScale <> { ttk::scale::Increment %W 1 } bind TScale <> { ttk::scale::Increment %W -10 } -bind TScale { ttk::scale::Increment %W -10 } +bind TScale <> { ttk::scale::Increment %W -10 } bind TScale <> { ttk::scale::Increment %W 10 } -bind TScale { ttk::scale::Increment %W 10 } +bind TScale <> { ttk::scale::Increment %W 10 } proc ttk::scale::Press {w x y} { variable State -- cgit v0.12