summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2014-05-27 19:55:16 (GMT)
committerjenglish <jenglish@flightlab.com>2014-05-27 19:55:16 (GMT)
commitc25ca6bc6c3d9e8d6360891bea3008d99aa6eda7 (patch)
tree92f0e874dfc33dd25f78b093821ed2bfa11909bf /library
parent8414099b7a1df5a198e52e6184d753ba980d63bc (diff)
parent3b641c87437e0c46c5d0044fb7d8776cb0a7057e (diff)
downloadtk-c25ca6bc6c3d9e8d6360891bea3008d99aa6eda7.zip
tk-c25ca6bc6c3d9e8d6360891bea3008d99aa6eda7.tar.gz
tk-c25ca6bc6c3d9e8d6360891bea3008d99aa6eda7.tar.bz2
ttk::entry, ttk::combobox: proposed fix for [a80f5d7165]:
keep track of whether a drag transaction is in progress; only initiate autoscroll in <B1-Leave> if selectMode is not "none" and %m is NotifyNormal.
Diffstat (limited to 'library')
-rw-r--r--library/ttk/entry.tcl38
1 files changed, 32 insertions, 6 deletions
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index be2299f..b3ebcbd 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -14,7 +14,7 @@ namespace eval ttk {
variable State
set State(x) 0
- set State(selectMode) char
+ set State(selectMode) none
set State(anchor) 0
set State(scanX) 0
set State(scanIndex) 0
@@ -74,9 +74,9 @@ bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
bind TEntry <B1-Motion> { ttk::entry::Drag %W %x }
-bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W }
-bind TEntry <B1-Enter> { ttk::CancelRepeat }
-bind TEntry <ButtonRelease-1> { ttk::CancelRepeat }
+bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m }
+bind TEntry <B1-Enter> { ttk::entry::DragIn %W }
+bind TEntry <ButtonRelease-1> { ttk::entry::Release %W }
bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
@@ -400,14 +400,40 @@ proc ttk::entry::DragTo {w x} {
char { CharSelect $w $State(anchor) $cur }
word { WordSelect $w $State(anchor) $cur }
line { LineSelect $w $State(anchor) $cur }
+ none { # no-op }
}
}
+## <B1-Leave> binding:
+# Begin autoscroll.
+#
+proc ttk::entry::DragOut {w mode} {
+ variable State
+ if {$State(selectMode) ne "none" && $mode eq "NotifyNormal"} {
+ ttk::Repeatedly ttk::entry::AutoScroll $w
+ }
+}
+
+## <B1-Enter> binding
+# Suspend autoscroll.
+#
+proc ttk::entry::DragIn {w} {
+ ttk::CancelRepeat
+}
+
+## <ButtonRelease-1> binding
+#
+proc ttk::entry::Release {w} {
+ variable State
+ set State(selectMode) none
+ ttk::CancelRepeat ;# suspend autoscroll
+}
+
## AutoScroll
# Called repeatedly when the mouse is outside an entry window
# with Button 1 down. Scroll the window left or right,
-# depending on where the mouse is, and extend the selection
-# according to the current selection mode.
+# depending on where the mouse left the window, and extend
+# the selection according to the current selection mode.
#
# TODO: AutoScroll should repeat faster (50ms) than normal autorepeat.
# TODO: Need a way for Repeat scripts to cancel themselves.