summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortreectrl <treectrl>2006-11-19 00:49:36 (GMT)
committertreectrl <treectrl>2006-11-19 00:49:36 (GMT)
commita6d60ba430fef31022994d5f0f4113ffaac567bd (patch)
treecb509db136228e26040bf13994dc86f48e01065d
parent7d51879c281d91b4d84a4c06b0dbe2568d4c10cf (diff)
downloadtktreectrl-a6d60ba430fef31022994d5f0f4113ffaac567bd.zip
tktreectrl-a6d60ba430fef31022994d5f0f4113ffaac567bd.tar.gz
tktreectrl-a6d60ba430fef31022994d5f0f4113ffaac567bd.tar.bz2
Defined TreeCtrl::lassign if ::lassign doesn't exist and use it instead of the classic foreach hack.
-rw-r--r--library/filelist-bindings.tcl6
-rw-r--r--library/treectrl.tcl13
2 files changed, 13 insertions, 6 deletions
diff --git a/library/filelist-bindings.tcl b/library/filelist-bindings.tcl
index a15f5c4..4062b6e 100644
--- a/library/filelist-bindings.tcl
+++ b/library/filelist-bindings.tcl
@@ -1,4 +1,4 @@
-# RCS: @(#) $Id: filelist-bindings.tcl,v 1.25 2006/11/05 06:43:28 treectrl Exp $
+# RCS: @(#) $Id: filelist-bindings.tcl,v 1.26 2006/11/19 00:49:36 treectrl Exp $
bind TreeCtrlFileList <Double-ButtonPress-1> {
TreeCtrl::FileListEditCancel %W
@@ -88,7 +88,7 @@ proc ::TreeCtrl::IsSensitive {T x y} {
if {[lindex $id 0] ne "item" || [llength $id] != 6} {
return 0
}
- foreach {where item arg1 arg2 arg3 arg4} $id {}
+ lassign $id where item arg1 arg2 arg3 arg4
if {![$T item enabled $item]} {
return 0
}
@@ -126,7 +126,7 @@ proc ::TreeCtrl::FileListButton1 {T x y} {
# Click in item
} else {
- foreach {where item arg1 arg2 arg3 arg4} $id {}
+ lassign $id where item arg1 arg2 arg3 arg4
switch $arg1 {
button -
line {
diff --git a/library/treectrl.tcl b/library/treectrl.tcl
index 11cdb97..c401871 100644
--- a/library/treectrl.tcl
+++ b/library/treectrl.tcl
@@ -1,4 +1,4 @@
-# RCS: @(#) $Id: treectrl.tcl,v 1.34 2006/11/18 04:37:49 treectrl Exp $
+# RCS: @(#) $Id: treectrl.tcl,v 1.35 2006/11/19 00:49:36 treectrl Exp $
bind TreeCtrl <Motion> {
TreeCtrl::CursorCheck %W %x %y
@@ -196,6 +196,13 @@ namespace eval ::TreeCtrl {
array set Priv {
prev {}
}
+
+ if {[info procs ::lassign] eq ""} {
+ proc lassign {values args} {
+ uplevel 1 [list foreach $args [linsert $values end {}] break]
+ lrange $values [llength $args] end
+ }
+ }
}
# Retrieve filelist bindings from this dir
@@ -433,7 +440,7 @@ proc ::TreeCtrl::ButtonPress1 {w x y} {
}
if {[lindex $id 0] eq "item"} {
- foreach {where item arg1 arg2} $id {}
+ lassign $id where item arg1 arg2
if {$arg1 eq "button"} {
$w item toggle $item
return
@@ -503,7 +510,7 @@ proc ::TreeCtrl::DoubleButton1 {w x y} {
return
}
if {[lindex $id 0] eq "item"} {
- foreach {where item arg1 arg2} $id {}
+ lassign $id where item arg1 arg2
if {$arg1 eq "button"} {
$w item toggle $item
return