On Wed, Feb 2, 2011 at 12:29 AM, Bob Sneidar <b...@twft.com> wrote: > Ok Peter helped me understand the GetDataOfIndex/SetDataOfIndex functions. I > think when I read, "- Retrieves the internal array for key pIndex of the > internal array in the data grid..." I just assumed that the returned value > would always be an array. I see now that if you reference a column name for > the second argument you get a value instead. >
Internally the datagrid works with arrays even if you populate with the dgText property. For populating a datagrid of 3 columns with the dgData property we could use a script such as: put "a1" into theData[1]["col1"] put "b1" into theData[1]["col2"] put "c1" into theData[1]["col3"] put "a2" into theData[2]["col1"] put "b2" into theData[2]["col2"] put "c2" into theData[2]["col3"] Now if you transpose this code as bricks or pieces of puzzle and encase each piece by index and column names you could get: theData[1]["col1"]["col2"]["col3"] a1 b1 c1 theData[2]["col1"]["col2"]["col3"] a2 b2 c2 Now let's join the col names and extract each index theData["col1"]["col2"]["col3"] 1 a1 b1 c1 2 a2 b2 c2 Then you have a double entry table: the datagrid. Understand how working with arrays is one of the key to understand the datagrid object, I think. It make good sense why a name of a column (not the label) must be filled and unique: its just a key in an array. getDataOfIndex simply read the corresponding value in a double entry table such as you could do it in a spreadsheet, by using A2 or L2C1 Best regards, -- -Zryip TheSlug- wish you the best! 8) http://www.aslugontheroad.co.cc _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode