summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authortreectrl <treectrl>2006-09-27 05:50:27 (GMT)
committertreectrl <treectrl>2006-09-27 05:50:27 (GMT)
commitaf3c2e03c0b107425f217cb822aa62480f523fad (patch)
tree5a8d1cfbcc5b0dfe09f3e7df578c51338240f0e5 /library
parentdc7190f555445beab0d97f8656f3685a6e237bf2 (diff)
downloadtktreectrl-af3c2e03c0b107425f217cb822aa62480f523fad.zip
tktreectrl-af3c2e03c0b107425f217cb822aa62480f523fad.tar.gz
tktreectrl-af3c2e03c0b107425f217cb822aa62480f523fad.tar.bz2
Fix control- and shift-clicks in an empty list. [Patch 1556387]
Diffstat (limited to 'library')
-rw-r--r--library/treectrl.tcl15
1 files changed, 10 insertions, 5 deletions
diff --git a/library/treectrl.tcl b/library/treectrl.tcl
index be558d7..2d54123 100644
--- a/library/treectrl.tcl
+++ b/library/treectrl.tcl
@@ -1,4 +1,4 @@
-# RCS: @(#) $Id: treectrl.tcl,v 1.24 2006/09/16 20:29:48 treectrl Exp $
+# RCS: @(#) $Id: treectrl.tcl,v 1.25 2006/09/27 05:50:27 treectrl Exp $
bind TreeCtrl <Motion> {
TreeCtrl::CursorCheck %W %x %y
@@ -640,7 +640,10 @@ proc ::TreeCtrl::Release1 {w x y} {
}
normal {
AutoScanCancel $w
- $w activate [$w item id [list nearest $x $y]]
+ set nearest [$w item id [list nearest $x $y]]
+ if {$nearest ne ""} {
+ $w activate $nearest
+ }
set Priv(prev) ""
}
resize {
@@ -698,10 +701,11 @@ proc ::TreeCtrl::BeginSelect {w item} {
proc ::TreeCtrl::SelectionMotion {w item} {
variable Priv
- if {$item eq $Priv(prev)} {
- return
- }
+
+ if {$item eq ""} return
+ if {$item eq $Priv(prev)} return
if {![$w item enabled $item]} return
+
switch [$w cget -selectmode] {
browse {
$w selection modify $item all
@@ -785,6 +789,7 @@ proc ::TreeCtrl::BeginExtend {w item} {
proc ::TreeCtrl::BeginToggle {w item} {
variable Priv
+ if {$item eq ""} return
if {[string equal [$w cget -selectmode] "extended"]} {
set Priv(selection) [$w selection get]
set Priv(prev) $item