summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/entry.tcl38
-rw-r--r--library/ttk/fonts.tcl2
-rw-r--r--library/ttk/progress.tcl4
-rw-r--r--library/ttk/scale.tcl5
4 files changed, 39 insertions, 10 deletions
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 2c9fbc8..f16cf8b 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 <Control-ButtonPress-1> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
@@ -404,14 +404,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.
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index 52298c5..a2781c6 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -60,7 +60,7 @@
namespace eval ttk {
-set tip145 [catch {font create TkDefaultFont}]
+variable tip145 [catch {font create TkDefaultFont}]
catch {font create TkTextFont}
catch {font create TkHeadingFont}
catch {font create TkCaptionFont}
diff --git a/library/ttk/progress.tcl b/library/ttk/progress.tcl
index b6e2ffb..34dce72 100644
--- a/library/ttk/progress.tcl
+++ b/library/ttk/progress.tcl
@@ -18,10 +18,10 @@ proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
return
}
- $pb step $stepsize
-
set Timers($pb) [after $steptime \
[list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
+
+ $pb step $stepsize
}
# ttk::progressbar::start --
diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl
index 23d08ed..4a534de 100644
--- a/library/ttk/scale.tcl
+++ b/library/ttk/scale.tcl
@@ -39,7 +39,7 @@ proc ttk::scale::Press {w x y} {
switch -glob -- [$w identify $x $y] {
*track -
*trough {
- set inc [expr {([$w get $x $y] <= [$w get]) ? -1 : 1}]
+ set inc [expr {([$w get $x $y] <= [$w get]) ^ ([$w cget -from] > [$w cget -to]) ? -1 : 1}]
ttk::Repeatedly Increment $w $inc
}
*slider {
@@ -84,5 +84,8 @@ proc ttk::scale::Release {w x y} {
proc ttk::scale::Increment {w delta} {
if {![winfo exists $w]} return
+ if {([$w cget -from] > [$w cget -to])} {
+ set delta [expr {-$delta}]
+ }
$w set [expr {[$w get] + $delta}]
}