diff options
author | Kevin Walzer <kw@codebykevin.com> | 2019-02-27 04:07:05 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2019-02-27 04:07:05 (GMT) |
commit | 930a9c0ad615486a65f23ed38729f06e1dfee051 (patch) | |
tree | 3aec75b96fdb678d5a825aa0f1ced7cf9c706a29 /library/entry.tcl | |
parent | cfb164ce628c937458881b4ebe5a81362a709086 (diff) | |
parent | c4097257d9d12d9e735ee2e1ff368e982e97c770 (diff) | |
download | tk-930a9c0ad615486a65f23ed38729f06e1dfee051.zip tk-930a9c0ad615486a65f23ed38729f06e1dfee051.tar.gz tk-930a9c0ad615486a65f23ed38729f06e1dfee051.tar.bz2 |
Update mac_services branch, intend to submit a TIP
Diffstat (limited to 'library/entry.tcl')
-rw-r--r-- | library/entry.tcl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/library/entry.tcl b/library/entry.tcl index 6243d26..286b38f 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -75,6 +75,9 @@ bind Entry <<TraverseIn>> { # Standard Motif bindings: bind Entry <1> { + if {[tk windowingsystem] eq "aqua"} { + tk::RegisterServiceWidget %W + } tk::EntryButton1 %W %x %W selection clear } @@ -113,6 +116,9 @@ bind Entry <B1-Enter> { } bind Entry <ButtonRelease-1> { tk::CancelRepeat + if {[tk windowingsystem] eq "aqua"} { + catch {::tk::CheckEntrySelection %W} + } } bind Entry <Control-1> { %W icursor @%x @@ -652,3 +658,26 @@ proc ::tk::EntryGetSelection {w} { } return $entryString } + +# ::tk::CheckEntrySelection -- +# +# Writes selected text to the clipboard on macOS. +# +# Arguments: +# w - The entry window from which the text to get + +proc ::tk::CheckEntrySelection {w} { + if {[$w selection present]} { + clipboard clear + clipboard append [::tk::EntryGetSelection $w] + } +} + + + + + + + + + |