I'm a complete beginner in Livecode and I didn't solve my problem about DataGrid...
After a query from a database, I get tab delimited data in several rows and columns; the numbers of columns and rows may change depending of the query but each data represents a few words or "1".
I don't know if it's possible to create a Datagrid table dynamically from this tab delimited data and in each cell containing "1" I'd like to get the image associated with the corresponding file : "Image_1.jpg".
I used the LiveCode lesson "How do I create a Datagrid dynamically from tab delimited data" to populate my DataGrid and adjust some properties but I don't know how to create dynamically an image into a cell from this DataGrid and then how to assign it to a file or an image in a card.
I've tested some codes but without any results, or with errors like in my last one :
Here is a part of my last code :
In the section "create row template", I've created a button called "flag" and then I've grouped it with the other components
Code: Select all
--create row template :
put the name of this stack into tMainstack
put "Data Grid Templates" && the seconds into tName
create invisible stack tName
set the mainStack of stack tName to tMainstack
go stack tName
create card
create field "label"
create graphic "Background"
create button "flag"
group field 1 and graphic 1 and button "flag"
set the name of last group to "Row Template"
go stack tMainstack
Code: Select all
-- Add images :
copy image id 8729 to stack tName
...
--point datagrid to template
set the dgProp["Row Template"] of group "my Datagrid" to the long id of group "Row Template" of stack tName
...
--add data :
put true into tFirstLineIsNames
set the dgText[tFirstLineIsNames] of group "my DataGrid" to tData
Code: Select all
set the icon of button "flag" to the id 8729
Is it the right way for such a task ?
Thank you in advance.
Fred