diff options
Diffstat (limited to 'library/spinbox.tcl')
-rw-r--r-- | library/spinbox.tcl | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 6a5f829..cb501ee 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -52,6 +52,7 @@ bind Spinbox <<Copy>> { } } bind Spinbox <<Paste>> { + global tcl_platform catch { if {[tk windowingsystem] ne "x11"} { catch { @@ -73,8 +74,8 @@ bind Spinbox <<PasteSelection>> { } bind Spinbox <<TraverseIn>> { - %W selection range 0 end - %W icursor end + %W selection range 0 end + %W icursor end } # Standard Motif bindings: @@ -119,52 +120,52 @@ bind Spinbox <Control-1> { %W icursor @%x } -bind Spinbox <<PrevLine>> { +bind Spinbox <Up> { %W invoke buttonup } -bind Spinbox <<NextLine>> { +bind Spinbox <Down> { %W invoke buttondown } -bind Spinbox <<PrevChar>> { +bind Spinbox <Left> { ::tk::EntrySetCursor %W [expr {[%W index insert] - 1}] } -bind Spinbox <<NextChar>> { +bind Spinbox <Right> { ::tk::EntrySetCursor %W [expr {[%W index insert] + 1}] } -bind Spinbox <<SelectPrevChar>> { +bind Spinbox <Shift-Left> { ::tk::EntryKeySelect %W [expr {[%W index insert] - 1}] ::tk::EntrySeeInsert %W } -bind Spinbox <<SelectNextChar>> { +bind Spinbox <Shift-Right> { ::tk::EntryKeySelect %W [expr {[%W index insert] + 1}] ::tk::EntrySeeInsert %W } -bind Spinbox <<PrevWord>> { +bind Spinbox <Control-Left> { ::tk::EntrySetCursor %W [::tk::EntryPreviousWord %W insert] } -bind Spinbox <<NextWord>> { +bind Spinbox <Control-Right> { ::tk::EntrySetCursor %W [::tk::EntryNextWord %W insert] } -bind Spinbox <<SelectPrevWord>> { +bind Spinbox <Shift-Control-Left> { ::tk::EntryKeySelect %W [::tk::EntryPreviousWord %W insert] ::tk::EntrySeeInsert %W } -bind Spinbox <<SelectNextWord>> { +bind Spinbox <Shift-Control-Right> { ::tk::EntryKeySelect %W [::tk::EntryNextWord %W insert] ::tk::EntrySeeInsert %W } -bind Spinbox <<LineStart>> { +bind Spinbox <Home> { ::tk::EntrySetCursor %W 0 } -bind Spinbox <<SelectLineStart>> { +bind Spinbox <Shift-Home> { ::tk::EntryKeySelect %W 0 ::tk::EntrySeeInsert %W } -bind Spinbox <<LineEnd>> { +bind Spinbox <End> { ::tk::EntrySetCursor %W end } -bind Spinbox <<SelectLineEnd>> { +bind Spinbox <Shift-End> { ::tk::EntryKeySelect %W end ::tk::EntrySeeInsert %W } @@ -192,10 +193,10 @@ bind Spinbox <Control-Shift-space> { bind Spinbox <Shift-Select> { %W selection adjust insert } -bind Spinbox <<SelectAll>> { +bind Spinbox <Control-slash> { %W selection range 0 end } -bind Spinbox <<SelectNone>> { +bind Spinbox <Control-backslash> { %W selection clear } bind Spinbox <KeyPress> { @@ -214,8 +215,6 @@ bind Spinbox <Escape> {# nothing} bind Spinbox <Return> {# nothing} bind Spinbox <KP_Enter> {# nothing} bind Spinbox <Tab> {# nothing} -bind Spinbox <Prior> {# nothing} -bind Spinbox <Next> {# nothing} if {[tk windowingsystem] eq "aqua"} { bind Spinbox <Command-KeyPress> {# nothing} } @@ -230,11 +229,31 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: +bind Spinbox <Control-a> { + if {!$tk_strictMotif} { + ::tk::EntrySetCursor %W 0 + } +} +bind Spinbox <Control-b> { + if {!$tk_strictMotif} { + ::tk::EntrySetCursor %W [expr {[%W index insert] - 1}] + } +} bind Spinbox <Control-d> { if {!$tk_strictMotif} { %W delete insert } } +bind Spinbox <Control-e> { + if {!$tk_strictMotif} { + ::tk::EntrySetCursor %W end + } +} +bind Spinbox <Control-f> { + if {!$tk_strictMotif} { + ::tk::EntrySetCursor %W [expr {[%W index insert] + 1}] + } +} bind Spinbox <Control-h> { if {!$tk_strictMotif} { ::tk::EntryBackspace %W @@ -375,8 +394,7 @@ proc ::tk::spinbox::ButtonDown {w x y} { $w selection clear } default { - return -code error -errorcode {TK SPINBOX UNKNOWN_ELEMENT} \ - "unknown spinbox element \"$Priv(element)\"" + return -code error "unknown spinbox element \"$Priv(element)\"" } } } |