summaryrefslogtreecommitdiffstats
path: root/library/panedwindow.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-02-26 01:06:55 (GMT)
committerhobbs <hobbs>2002-02-26 01:06:55 (GMT)
commit3b8d498e8bfb88e531bdfa6fe1149e5b255c98d1 (patch)
treed912c2ce9ddc4ed0e707347e97fe8c1efcd0b2c0 /library/panedwindow.tcl
parent8524a21e97d49a594aff3d8534448099e338f18c (diff)
downloadtk-3b8d498e8bfb88e531bdfa6fe1149e5b255c98d1.zip
tk-3b8d498e8bfb88e531bdfa6fe1149e5b255c98d1.tar.gz
tk-3b8d498e8bfb88e531bdfa6fe1149e5b255c98d1.tar.bz2
improved proxy sash handling. (boudaillier)
Diffstat (limited to 'library/panedwindow.tcl')
-rw-r--r--library/panedwindow.tcl16
1 files changed, 9 insertions, 7 deletions
diff --git a/library/panedwindow.tcl b/library/panedwindow.tcl
index dbdcaa8..073c47f 100644
--- a/library/panedwindow.tcl
+++ b/library/panedwindow.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk panedwindow widgets and
# provides procedures that help in implementing those bindings.
#
-# RCS: @(#) $Id: panedwindow.tcl,v 1.4 2002/02/23 01:36:45 hobbs Exp $
+# RCS: @(#) $Id: panedwindow.tcl,v 1.5 2002/02/26 01:06:55 hobbs Exp $
#
bind PanedWindow <Button-1> { ::tk::panedwindow::MarkSash %W %x %y 1 }
@@ -41,6 +41,9 @@ proc ::tk::panedwindow::MarkSash {w x y proxy} {
if { !$::tk_strictMotif || [string equal $which "handle"] } {
if {!$proxy} { $w sash mark $index $x $y }
set ::tk::Priv(sash) $index
+ foreach {sx sy} [$w sash coord $index] break
+ set ::tk::Priv(dx) [expr {$sx-$x}]
+ set ::tk::Priv(dy) [expr {$sy-$y}]
}
}
}
@@ -60,10 +63,11 @@ proc ::tk::panedwindow::MarkSash {w x y proxy} {
proc ::tk::panedwindow::DragSash {w x y proxy} {
if { [info exists ::tk::Priv(sash)] } {
if {$proxy} {
- $w proxy place $x $y
+ $w proxy place \
+ [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
} else {
- $w sash dragto $::tk::Priv(sash) $x $y
- $w sash mark $::tk::Priv(sash) $x $y
+ $w sash place $::tk::Priv(sash) \
+ [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
}
}
}
@@ -83,11 +87,9 @@ proc ::tk::panedwindow::ReleaseSash {w proxy} {
if {$proxy} {
foreach {x y} [$w proxy coord] break
$w sash place $::tk::Priv(sash) $x $y
- unset ::tk::Priv(sash)
$w proxy forget
- } else {
- unset ::tk::Priv(sash)
}
+ unset ::tk::Priv(sash) ::tk::Priv(dx) ::tk::Priv(dy)
}
}