LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I am having a difficult time understanding the true nature of dgData when used with a DataGrid. What actually are the components of an element of dgData? I can use a script such as the following with my DataGrid and look at individual elements in the IDE.
answer tData[2][6] -- where 6 is the column containing the current price
I get nothing.
I guess my question is: Is tData a two element array or a three element array or something in between?
I ask this because I am looking for a way to add a new element to dgData using dgData rather than dgLine.
Thanks in advance for ant light you can shed on this.
Regards,
Larry
All arrays in Rev are implemented as associative arrays, simple name-value pairs. So you'd get a value in tArray[2] only if the key to that element is the numeral "2".
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
All arrays in Rev are implemented as associative arrays, simple name-value pairs. So you'd get a value in tArray[2] only if the key to that element is the numeral "2".
Does that mean that dgData is a two dimensional array where the first element is an Index number and the second element is a string that names a column in the array and the combination of the two maps to a specifuc element in the grid?
Richard is correct. The Data Grid numerically indexes the first dimension (that is the index referred to throughout the API). The 2nd dimension contains the names that you used when you populated the Data Grid. In the case of a Data Grid table this is typically just the names of the columns in your Data Grid but you are in no way restricted to just using the column names.
If you want to see exactly what the dgData looks like try this:
If you want to see exactly what the dgData looks like try this:
CODE: SELECT ALL
dispatch "PrintKeys" to group "DataGrid"
Does this command have limitations to the size of the grid it can handle? My grid with about 12 rows of 15 columns would not show but a small 3x3 grid appeared nicely both from the message box and under program control. The larger grid showed nothing from the message box and stepping from program control showed 'it' as 'handled' but the variable into which I was going to put the data showed nothing.
Anyway, thanks to your help and the help of others I'm beginning to get the hang of DataGrids.
There is no size limitation. The 12x15 table should print off fine. Were you editing the Data Grid behavior script by chance? If so then it is possible you wiped out the script local variable that stores the Data Grid data. This would cause PrintKeys to show no results.