Tk Library Source Code

Artifact [fc8fac8329]
Login

Artifact fc8fac8329096315b86f921a40b2fe4552d88b8e:

Attachment "2962077-reenable-array-elements-as-textvars.patch" to ticket [2962077fff] added by wtschueller 2010-04-11 15:12:48.
# HG changeset patch
# User W T Schueller <[email protected]>
# Date 1270972271 -7200
# Node ID c817f8e16933a999bd685852ee9015cc35bb743a
# Parent  8baaec9c23692cbabd4167efa189a6728c1f0043
added test for array variable in traceFired(6), don't know if upvaring to an array element is a good idea, at least traceFired passes the test now

diff -r 8baaec9c2369 -r c817f8e16933 ipentry.tcl
--- a/ipentry.tcl	Sun Apr 11 06:45:28 2010 +0000
+++ b/ipentry.tcl	Sun Apr 11 09:51:11 2010 +0200
@@ -11,7 +11,7 @@
 # RCS: @(#) $Id$
 
 package require Tk
-package provide ipentry 0.3
+package provide ipentry 0.3.1
 
 namespace eval ::ipentry {
     namespace export ipentry ipentry6
@@ -746,7 +746,12 @@
 #       nothing
 #
 proc ::ipentry::traceFired {w name key op} {
-    upvar #0 $name var
+    # check if textvariable refers to an array element
+    if { $key == "" } then {
+        upvar #0 $name var
+    } else {
+        upvar #0 [set name]($key) var
+    }
     if {[info level] > 1} {
         set caller [lindex [info level -1] 0]
         if {$caller == "::ipentry::updateTextvar" || $caller == "::ipentry::traceFired"} { return }
@@ -780,7 +785,12 @@
 #       nothing
 #
 proc ::ipentry::traceFired6 {w name key op} {
-    upvar #0 $name var
+    # check if textvariable refers to an array element
+    if { $key == "" } then {
+        upvar #0 $name var
+    } else {
+        upvar #0 [set name]($key) var
+    }
     if {[info level] > 1} {
         set caller [lindex [info level -1] 0]
         if {$caller == "::ipentry::updateTextvar" || $caller == "::ipentry::traceFired6"} { return }
diff -r 8baaec9c2369 -r c817f8e16933 pkgIndex.tcl
--- a/pkgIndex.tcl	Sun Apr 11 06:45:28 2010 +0000
+++ b/pkgIndex.tcl	Sun Apr 11 09:51:11 2010 +0200
@@ -1,3 +1,3 @@
 if { ![package vsatisfies [package provide Tcl] 8.4] } { return }
-package ifneeded ipentry 0.3 [list source [file join $dir ipentry.tcl]]
+package ifneeded ipentry 0.3.1 [list source [file join $dir ipentry.tcl]]