summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-04-30 11:40:13 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-04-30 11:40:13 (GMT)
commit22119027ff83c020947fe6d3a875bfb29d61ded7 (patch)
treeebe929d4187f3895cca5ae2af72be85db4ffd931 /library/ttk
parenta8c34c498bbbe9857df1594751173a188287241c (diff)
downloadtk-22119027ff83c020947fe6d3a875bfb29d61ded7.zip
tk-22119027ff83c020947fe6d3a875bfb29d61ded7.tar.gz
tk-22119027ff83c020947fe6d3a875bfb29d61ded7.tar.bz2
Automatically bind text, entry, ttk::entry widgets to Services API at widget creation/mapping; re-work data mechanism to use selection rather than clipboard API, thanks to Marc Culler for that insight
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/entry.tcl30
1 files changed, 7 insertions, 23 deletions
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 6d5be07..50f866d 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -58,6 +58,13 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault
# and I'll put it back.
#
+##Bindings to register with macOS Services API.
+bind T.Entry <Map> {
+ if {[tk windowingsystem] eq "aqua"} {
+ ::tk::RegisterServiceWidget %W
+ }
+}
+
## Clipboard events:
#
bind TEntry <<Cut>> { ttk::entry::Cut %W }
@@ -348,9 +355,6 @@ proc ttk::entry::Press {w x} {
set State(x) $x
set State(selectMode) char
set State(anchor) [$w index insert]
- if {[tk windowingsystem] eq "aqua"} {
- ::tk::RegisterServiceWidget $w
- }
}
## Shift-Press -- Shift-ButtonPress-1 binding.
@@ -430,9 +434,6 @@ proc ttk::entry::Release {w} {
variable State
set State(selectMode) none
ttk::CancelRepeat ;# suspend autoscroll
- if {[tk windowingsystem] eq "aqua"} {
- catch {::ttk::CheckEntrySelection $w}
- }
}
## AutoScroll
@@ -610,21 +611,4 @@ proc ttk::entry::Delete {w} {
}
}
-if {[tk windowingsystem] eq "aqua"} {
- # ::ttk::CheckEntrySelection --
- #
- # Writes selected text to the clipboard on macOS.
- #
- # Arguments:
- # w - The entry window from which the text to get
-
- proc ::ttk::CheckEntrySelection {w} {
- if {[$w selection present]} {
- clipboard clear
- clipboard append [::ttk::entry::EntrySelection $w]
- }
- }
-}
-
-
#*EOF*