Cloning card with datagrid

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
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Cloning card with datagrid

Post by MaxV » Wed Aug 28, 2013 4:28 pm

Hi,
I have to create a PDF with many page, every page has it's own datagrid with 2 columns (named "Decrizione" and "Importo").
The first page is the master page, all other pages are cloned from the first one. The problem is that all cloned page has the label of the columns inverted (data are in the correct order :?: ), but only the first (master) page is ok. Since all other elements and the data loaded in the datagrid are ok, I don't know what is wrong :(
Moreover I use the master page and add data in it like in all others..
I use the following code to load data in the data grid in every page cloned:

Code: Select all

clone this card
put 1 into n #line counter
repeat for each line riga in tRecords   
  put the first item of riga into myArr[n]["Descrizione"]
  put the second item of riga into myArr[n]["Importo"]         
  add 1 to n
end repeat      
set the dgData of group "voci" to myArr   
delete variable myArr
Here is the results:
Image

Any ideas?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14222
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Cloning card with datagrid

Post by Klaus » Wed Aug 28, 2013 4:35 pm

Buongiorno Max :-)

hmm, sound like a bug to me!

is your datagrid of type TABLE?
If yes, you could simply set its DGTEXT to tRecords!
And better you could do this:
...
## We put the HEADER into the first line of the data for the datagrid:
put "Descrizione" & TAB & "Importo" into tData

## Now we add the actual data
put CR & tRecords after tData

## Now we tell Livecode that the first line contains our headers for the datagrid:
set the dgtext[TRUE] of grp "whatever" to tData
...
That should "fix" the wrong order of the headers.


Best

Klaus

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Cloning card with datagrid

Post by MaxV » Wed Aug 28, 2013 4:41 pm

I suspect that it's a bug too. I inspected the Label property values and they are correct, but someway when cloning... some scramble labels rendering...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Cloning card with datagrid

Post by MaxV » Wed Aug 28, 2013 4:59 pm

There is some memory management bug, closing all the IDE and reopening it all seem resolved
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply