Define Datagrid Form Columns
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Define Datagrid Form Columns
Hi, hope someone can help me on this please.
I can't see how the columns used in a Datagrid Form are defined. In the tutorial "Creating a list of people" the datagrid behaviour script FillInData uses values from columns pDataArray["LastName"], pDataArray["FirstName"], pDataArray["Title"] and pDataArray["Image URL"], which works fine when I follow the exercise.
e.g.
set the text of field "Name" of me to pDataArray["LastName"] & comma & space & pDataArray["FirstName"]
set the text of field "Title" of me to pDataArray["Title"]
set the filename of image "image" of me to pDataArray["Image URL"]
But if I create a new Datagrid Form the columns seem to be setup automatically as "label 1", "label 2", "label 3"which I found just by guessing!
i.e. this code in a new Datagrid Form behaviour script works fine:
set the text of field "Width" of me to pDataArray["label 1"]
set the text of field "Height" of me to pDataArray["label 2"]
set the text of field "Name" of me to pDataArray["label 3"]
But where does label 1 etc come from? In a data grid table then they are setup in the properties but when you choose a Datagrid Form the columns tab disappears. I haven't setup label 2 or label 3, are they the defaults in the pDataArray variable?
Any help or suggestions gratefully received on to how to specify the column headers in a Datagrid Form?
Roger
I can't see how the columns used in a Datagrid Form are defined. In the tutorial "Creating a list of people" the datagrid behaviour script FillInData uses values from columns pDataArray["LastName"], pDataArray["FirstName"], pDataArray["Title"] and pDataArray["Image URL"], which works fine when I follow the exercise.
e.g.
set the text of field "Name" of me to pDataArray["LastName"] & comma & space & pDataArray["FirstName"]
set the text of field "Title" of me to pDataArray["Title"]
set the filename of image "image" of me to pDataArray["Image URL"]
But if I create a new Datagrid Form the columns seem to be setup automatically as "label 1", "label 2", "label 3"which I found just by guessing!
i.e. this code in a new Datagrid Form behaviour script works fine:
set the text of field "Width" of me to pDataArray["label 1"]
set the text of field "Height" of me to pDataArray["label 2"]
set the text of field "Name" of me to pDataArray["label 3"]
But where does label 1 etc come from? In a data grid table then they are setup in the properties but when you choose a Datagrid Form the columns tab disappears. I haven't setup label 2 or label 3, are they the defaults in the pDataArray variable?
Any help or suggestions gratefully received on to how to specify the column headers in a Datagrid Form?
Roger
Re: Define Datagrid Form Columns
Hi Roger,
how are you creating the ARRAY used to fill in the data?
They must be created somewhere and at some pont and that's the time where the names of the keys are defined!
Best
Klaus
how are you creating the ARRAY used to fill in the data?
They must be created somewhere and at some pont and that's the time where the names of the keys are defined!
Best
Klaus
Re: Define Datagrid Form Columns
Thanks Klaus
I started to think it must be something to do with the pDataArray array variable. But I did not create it, just added a Datagrid to my card and set it as a form.
Presumerably the array is set by default. Does this mean I just need to modify the pDataArray?
THanks for your assistance so far!
I started to think it must be something to do with the pDataArray array variable. But I did not create it, just added a Datagrid to my card and set it as a form.
Presumerably the array is set by default. Does this mean I just need to modify the pDataArray?
THanks for your assistance so far!
Re: Define Datagrid Form Columns
OK, but how do you get whatever data into your datagrid?
There is nothing that could happen automatically this way,
there must be s script involved somehow at some point!
There is nothing that could happen automatically this way,
there must be s script involved somehow at some point!
Re: Define Datagrid Form Columns
Ok I think I have solved it!
If you:
1. Add a datagrid control(by default it is a table)
2. Change to a Form
3. Edit Behaviour script - then the columns headers are named label 1, label 2, label 3 - etc.
However if you:
1. Add a datagrid control (by default it is a table)
2. Configure columns in the table (e.g. naming them Width, Height and Name)
3. Change to a Form
Then the behaviour script and pDataArray uses the columns names assigned in the original datagrid table
i.e. this code works in the behavior script:
Thanks for your input, just writing it down and getting feedback helps to make it clearer.
If you:
1. Add a datagrid control(by default it is a table)
2. Change to a Form
3. Edit Behaviour script - then the columns headers are named label 1, label 2, label 3 - etc.
However if you:
1. Add a datagrid control (by default it is a table)
2. Configure columns in the table (e.g. naming them Width, Height and Name)
3. Change to a Form
Then the behaviour script and pDataArray uses the columns names assigned in the original datagrid table
i.e. this code works in the behavior script:
Code: Select all
on FillInData pDataArray
set the text of field "Height" of me to pDataArray["Height"]
set the text of field "Name" of me to pDataArray["Name"]
end FillInData
Re: Define Datagrid Form Columns
Why a day? Clearly a spammer, even without today's evidence
Re: Define Datagrid Form Columns
I am a generous guy, you know, but whom ecxactly are you talking about?
Re: Define Datagrid Form Columns
Him, over there behind that pile of distraction
Re: Define Datagrid Form Columns
Ah, I see!
Not!
Not!