How to populate the controls on a DataGrid Form
Posted: Sun Jan 13, 2013 11:18 am
Hi again,
My 'successess' seem to remain very short lived - IF indeed, they were ever successes I could loosely claim ownership to in the first instance ! (So far, I need to thank Klaus for showing me the path on each occasion...
) - Thanks again Klaus. Having said that, this remains a painful and rather steep learning curve even with webcasts, books, dictionaries, help files and the forum etc...
My problem now is how to populate some controls (labels and an image) within a DataGrid set up as a 'Form' from an SQLite Database...
I have my SQLite database which holds my data (so far just two items consisting of database ID, Name, Address and Image - the image field is by way of a path to the 'SpecialFolder' & "\Images" folder)
Thanks Klaus
I have set up the DataGrid (I think
) as a form called 'dgPeople' and placed a group (dgPeople) of controls into it ('lblID', 'lblName', 'btnImage' and 'lblAddress')
Thanks Datagrid webcast - courtesy team Revolution and example video/stack - courtesy LiveCode
I can query the SQLite Database - and can 'see' the results (break point in my code) going into a local 2 dimensional Array variable called 'sDataArray'
After finishing the SQL query and subsequent array population I send the data to my Datagrid with this call
I can then 'trap' this call at the 'FillInData pDataArray' behaviour script attached to my DataGrid.
All well so far (This took me the best part of yesterday
but at least I can 'see' the data entering the behaviour script by placing a breakpoint in it
My problem starts when I try to populate my four Datagrid controls with the data in 'pDataArray'.
Firstly I 'expected' the 'FillInData' code to be called once with the full array of data 'pDataArray' but, it would appear that, in reality we seem to jump into this code the same number of times that we have data lines (records) for... I've ammended my Datagrid population cotrol for this and it ends up as :
When I 'Apply' these code lines to the Behaviour Script I receive a big green tick and no errors
However, when LC attempts to run this script I receive the following (somewhat cryptic - to me!) error :
button "Behavior Script": execution error at line 8 (Chunk: no such object) near "lblID", char 22
with execution halted on line 1 (put pDataArray[1] into the field "lblID" of me) of my four code lines (above)...
I have checked that lblID exists in my Datagrid and that my data is intact (within 'pDataArray') at this point and have attempted various mutations of
put pDataArray[1] into the field "lblID" of me
such as
put pDataArray[1] into field "lblID" of me
put pDataArray[1] into the control "lblID" of me
put pDataArray[1] into control "lblID" of me
plus every other option I can think of.
I have watched and re-watched the webcasts
I have worked my way through the examples and .... arghhhh !
I have spent HOURS at this point and gotten nowhere !
I'm quite obviously missing / overlooking some vital point(s) but... what / which one(s).
Can anyone assist please ?
Thanks in advance.
My 'successess' seem to remain very short lived - IF indeed, they were ever successes I could loosely claim ownership to in the first instance ! (So far, I need to thank Klaus for showing me the path on each occasion...


My problem now is how to populate some controls (labels and an image) within a DataGrid set up as a 'Form' from an SQLite Database...
I have my SQLite database which holds my data (so far just two items consisting of database ID, Name, Address and Image - the image field is by way of a path to the 'SpecialFolder' & "\Images" folder)
Thanks Klaus
I have set up the DataGrid (I think

Thanks Datagrid webcast - courtesy team Revolution and example video/stack - courtesy LiveCode
I can query the SQLite Database - and can 'see' the results (break point in my code) going into a local 2 dimensional Array variable called 'sDataArray'
After finishing the SQL query and subsequent array population I send the data to my Datagrid with this call
Code: Select all
set the dgData of group "dgPeople" to sDataArray
All well so far (This took me the best part of yesterday


My problem starts when I try to populate my four Datagrid controls with the data in 'pDataArray'.
Firstly I 'expected' the 'FillInData' code to be called once with the full array of data 'pDataArray' but, it would appear that, in reality we seem to jump into this code the same number of times that we have data lines (records) for... I've ammended my Datagrid population cotrol for this and it ends up as :
Code: Select all
put pDataArray[1] into the field "lblID" of me
put pdataArray[2] into the field "lblName" of me
set pDataArray[3] into the icon of control "btnImage" of me
put pDataArray[4] into the field "lblAddress" of me

However, when LC attempts to run this script I receive the following (somewhat cryptic - to me!) error :
button "Behavior Script": execution error at line 8 (Chunk: no such object) near "lblID", char 22
with execution halted on line 1 (put pDataArray[1] into the field "lblID" of me) of my four code lines (above)...
I have checked that lblID exists in my Datagrid and that my data is intact (within 'pDataArray') at this point and have attempted various mutations of
put pDataArray[1] into the field "lblID" of me
such as
put pDataArray[1] into field "lblID" of me
put pDataArray[1] into the control "lblID" of me
put pDataArray[1] into control "lblID" of me
plus every other option I can think of.
I have watched and re-watched the webcasts
I have worked my way through the examples and .... arghhhh !
I have spent HOURS at this point and gotten nowhere !
I'm quite obviously missing / overlooking some vital point(s) but... what / which one(s).
Can anyone assist please ?
Thanks in advance.