How to get a same data grid on each card?
Andre.Bisseret
Andre.Bisseret at inria.fr
Sun Jan 3 10:47:28 EST 2010
Bonjour Trevor (and all)
I have an old app I built in HC, then I converted in Rev. and that I
am using quite a lot.
Now, I am transforming it in a true Rev app ;-))
On each card on a stack I have a background including, among other
objects, a table whose columns are made with grouped scrolling fields
(an old solution ;-)
I would like to replace this with a data grid.
My first attempt was to put a data grid in the background, expecting I
could populate it with specific data on each card.
But seems this is not possible. When doing "new card", I get a data
grid on the new card,
- without the columns headers, which is not a big issue,
- but when I populate the data grid on the new card the data grid on
the previous one is emptied
So I understand that in fact, the data grid which is replicated on
each card can be populated only on the current card.
In other word including a data grid in a group with background
behavior set to true seems not a good idea. I found an answer from
Trevor in the archives that seems to confirm that.
-------------
"If you want to have different data on each card (I assume you are
sharing the data grid across cards) then you would need to:
a) Load the data into the data grid on open card each time a card opens.
b) Create separate data grids for each card."
-------------
In my case, I can't do a), I have to do b)
Then, I red the lesson which explains how to create a data grid
through script.
But I am trying to avoid re-defining for each new card, the properties
of the data grid (columns, their names and labels, their width etc.
So my later trial is as follow :
I create a data grid "dataGrid" (with all needed properties defined)
on the first card of the stack.
I don"t include it in the background of this first card
Then, when I create a new card I do :
copy grp "DataGrid" of cd 1 of this stack
paste
set the dgText of grp "DataGrid" to empty
So I get a data grid (with the same name) on each new card ready to be
specifically populated for this card.
Seems to work well :-)
Trevor, is this a good way to go or are there some warning against it?
Thanks a lot in advance for any advice
Heureuse année 2010
André
More information about the use-livecode
mailing list