using data grid form

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

using data grid form

Post by mattmaier » Sat Sep 20, 2014 9:11 pm

I would appreciate some help understanding the basic instructions on how to use a data grid form.

http://lessons.runrev.com/m/datagrid/l/ ... -of-people
steps in the people example
1) create the form
2) mess around with controls on the row template
3) edit the fillInData message to map elements of pDataArray to the controls on the row template
4) mess around with laying out the controls when they display
5) the command uiPopulatePeople creates theDataA which then sets dgData (in the card script)
6) call the uiPopulatePeople command to display the data in the form

http://lessons.runrev.com/m/datagrid/l/ ... -with-data
"There are a couple of ways to assign data to a data grid"
1) paste text into the contents section of the property inspector
2) set the dgText property (this seems to be an intermediate step that converts your text into an array)
3) set the dgData property (this seems to be the actual array used to populate the form)

Q: Is dgData the actual default location the DataGrid stack will look for information to display in the data grid control?
Q: I need to edit fillInData because the template doesn't know what controls I created, but what array gets passed in as pDataArray?
Q: Does dgData become pDataArray inside fillInData?
Q: The example implies that just filling dgData (using the command uiPopulatePeople) displays the data in the control. If that's the case when does anything talk to fillInData to find out how to display the array?
Q: fillInData is where I tell the engine which array elements go in which controls for display. Is dgData where I tell the engine which array elements from my project go in which array elements in the data grid's expected format?
Q: The data grid expects a two-dimensional array. If my data is in a three/four/five/etc-dimensional array, do I have to flatten it into two dimensions?

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: using data grid form

Post by mattmaier » Sun Sep 21, 2014 7:22 pm

Hokay, so. I'm still not sure what's going on behind the scenes, but this process seems to be working for me.

1) the relevant control (a button probably) should send a custom command message
2) the handler for that message should be on the card. In that handler the dgData property should be set to something.
3) as long as fillInData has the correct instructions to map the data structure to the GUI controls, the form will fill in with the data.
4) at that point, the whole template may or may not display correctly. If it's taller than one line the variable height option needs to be selected in the property inspector
5) then the layout controls need to be adjusted because the template probably won't scale to fit the current dimensions of the data grid properly

That's as far as I got. I'm leaving it here in case someone else has the same problem.

Post Reply