From af3c2e03c0b107425f217cb822aa62480f523fad Mon Sep 17 00:00:00 2001 From: treectrl Date: Wed, 27 Sep 2006 05:50:27 +0000 Subject: Fix control- and shift-clicks in an empty list. [Patch 1556387] --- library/treectrl.tcl | 15 ++++++++++----- 1 file 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 { 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 -- cgit v0.12