Problems using an array within another array 
Author Message
 Problems using an array within another array

 Hi,
 I have an array of global data called Globals and at the element called
entryInfo I want to put another array keyed by entry widget pathnames:
I tried to do it like this:

# First initialize it with an array ...
        set x(null) 0
        set Globals(entryInfo) x

# Then set elements ...
    set $Globals(entryInfo)(.frame.entryA)  ABC

# Then at the same scope level, I can retrieve the value "ABC" like this:

        set value [set  $Globals(entryInfo)(.frame.entryA)]

This works, though very cumbersome. But if I then call the following
simple proc, I then get an error because the array x was also not declared
global:

proc p {} {
  global Globals
  set value [set  $Globals(entryInfo)(.frame.entryA)]
  puts stdout $value

Quote:
}

# When p is invoked ...
#Error: can't read "x(.frame.entryA)": no such variable

I understand why I get the error, but I don't want to have to declare the
second array global!

SO MY QUESTION IS,
  Is there a better way of setting up and using arrays within global arrays?
(I can't seem to use a keyed-list here because the key, ".frame.entryA" gets
misinterpreted as having sub-fields.)

--
Jerry Liebelson




Fri, 22 Mar 1996 23:41:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. An array of records within an array of records (Still a problem)

2. convert 2d array to 1d array without using shift registers and build array

3. Problem with with Array of U8 to Array of Array of Boolean

4. Arrays within UDT Arrays - Uggh!

5. an array of records within an array of records

6. Inserting Arrays within an Array in Tcl...

7. Difficult problem to solve: Tcl 7.3 to Tcl 8.0p2 Array of Array Problem

8. Filling arrays with arrays using afill()

9. AWK using an array to subscript an array??

10. using an array as subscripts for multidimensional arrays

11. Arrays: Build array in multiple for loops or replace array elements

12. Multidimensional array vs. array of array

 

 
Powered by phpBB® Forum Software