Using Arrays

Mark Wieder mwieder at
Fri Jun 3 22:10:00 EDT 2011


Friday, June 3, 2011, 6:57:01 PM, you wrote:

>  If you then *put the keys of tArray[1]* you will see the
> column keys, col1 and col2, so to get a specific cell is as you've been
> trying to do with the dgtext  tarray[1]["col1"] will get the data from row 1
> col 1.

> I do not get this behaviour.  This only gives me the column keys,
> not column keys and col1, and col2.

> WHAT gets the data from row 1 col 1?

-- it's a two-dimensional array
-- in C++ it's called a hash
-- dgData[column][row] will access a single element

put the dgData of group "YourGrid" into tArray

put the keys of tArray -- this will give you the row names
put the keys of tArray[1] -- this will give you the column names

-- assuming you have a column names "ColumnName"
-- this will set the "ColumnName" of the first row to "hello"

put "hello" into tArray[1]["ColumnName"]
set the dgData of group "YourGrid"  to tArray

-Mark Wieder
 mwieder at

More information about the Use-livecode mailing list