GetDataOfLine won't work for me because I may be referencing a cell that is not 
visible. I am updating the first empty cell of a column, so I have to use 
index. Also, the API does not mention anything about the second arguement. I 
quote: 

dgDataOfIndex
- get the dgDataOfIndex [ pIndex ]
- set the dgDataOfIndex [ pIndex ] of group "DataGrid" to pDataA
- Get or set the data associated with a particular index. The value is the 
array assigned to that index. Note that setting the data of an index will cause 
the data grid to refresh the row associated with the index if it is visible on 
screen.

put the dgDataOfIndex[1] of group "DataGrid" into theMessageA
put theMessageA["message"] -- puts "hi"

Thanks for the tip, maybe the API needs updating at some point. I hope it is as 
simple as that! 

Bob


On Feb 1, 2011, at 3:05 PM, Peter Haworth wrote:

> Have you tried GetDataofIndex/GetDataofLine?  
> 
> put GetDataofLine(linenumber,columnname) into xyz
> 
> there's corresponding setData commands as well.
> 
> setDataofLine linenumber,columnname,value
> You have to do a RefreshLine after setDataofLine to see the results in the 
> datagrid.
> 
> Pete Haworth
> 
> On Feb 1, 2011, at 2:45 PM, Bob Sneidar wrote:
> 
>> Hi all. 
>> 
>> I am still having fits doing what I want. Perhaps in the past I have not 
>> described it very well, so I am going to try a different approach. 
>> 
>> What I need is to access the value in a single cell of a data grid and 
>> change it. For instance I would like to do something like:
>> 
>> set the value of column 1 of row 1 of myDatagrid to "test". Better yet, 
>> although I know this is wishful thinking, set the 1:1 of myDataGrid to 
>> "test". Or how about, set the 1:1 to 1:3 of myDataGrid to "test1" & tab & 
>> "test2" & tab & "test3"? That was the kind of API I envisioned for a table 
>> object. I know that is simplistic, but I am not getting what I expect to get 
>> when I use the existing datagrid API. 
>> 
>> I have really tried to understand the API but I am at a total loss. I don't 
>> want to work with arrays here, I want to work with the indexes that the API 
>> returns. The closest I can get is to get and set the dgDataOfIndex but those 
>> are arrays. I don't want to change the whole line. I don't want to have to 
>> put the whole line back together when I only want to change the one value in 
>> the one column in the one row. Is this even possible? 
>> 
>> If not I understand, but it sure oughta be don't you think? Permit me a 
>> small rant. Shouldn't a table object work kind of like a spreadsheet, where 
>> I can reference a row and a column and get/set a value? This is really what 
>> I need. Knowing the internal array structure has not helped me. 
>> 
>> I have gotten the dgDataOfIndex for a data grid, modified the first element 
>> in the array,  set the dgDataOfIndex and then used DataGrid Helper to show 
>> me the contents of the data grid. The array is IDENTICAL to the one I get if 
>> I manually edit the values, but if I do it using code the datagrid appears 
>> empty, and refreshing the datagrid does not help. 
>> 
>> So I guess until there is a method of simple row:column referencing of 
>> datagrids, I am going to revert to using the dgText. Thank GOD and thank 
>> Trevor for this, or for me data grids would be unusable. 
>> 
>> <end_rant>
>> 
>> Bob
>> 
>> ps. Thanks Zryip for all the help, but it appears your methods call things 
>> in the parent script that I cannot see or access (that may be a good thing) 
>> and so I cannot see what they are doing and why. I need to see code happen 
>> to understand it. 
>> _______________________________________________
>> 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
>> 
> 
> 
> _______________________________________________
> 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


_______________________________________________
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

Reply via email to