LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I'm experiencing something with a DataGrid that appears to be writing new data over the top of old data. It happens only occasionally and it gives the appearance of bold printing in the grid often with a grid headings missing. It can be cleared up with a refresh data grid but in the case of new data being written over old data the refresh grid leaves only the new data and looses the rest. I have no idea what I'm doing to cause this so if anyone has encountered this problem and knows a solution I would be most appreciative.
I am not doing anything very fancy with my grids and the bits of code below show my most common way of dealing with the data:
put the dgText of group "DataGrid 1" into tData
set the itemdelimiter to tab
-- process the tData by either changing specific items in rows or adding and deleting rows
set the dgText of group "DataGrid 1" to tData
I realize there are more sophisticated ways of dealing with DataGrids but shouldn't this method provide good results on a consistent basis?
Since no one has as yet commented, I thought I'd better add some more information. I have included a before and after picture of the 'double data' and the code I use to clear up the situation. The problem shown here only is present immediately upon opening the application either from the IDE or the .app. Once I press cCmmand-R to trigger my script for each card, everything seems to be OK for the duration of use.
BEFORE
[img]/Users/Larry/Desktop/Before.tiff[/img]
on RefreshGrid
put the number of controls of this card into tControls
repeat with i = 1 to tControls
put name of control i into thisControl
if offset("DataGrid ",thisControl) > 0 then
dispatch "RefreshList" to thisControl
dispatch "ResetList" to thisControl
exit repeat
end if
end repeat
end RefreshGrid
I tried again with .jpg and it does not seem to show in preview. I am just dragging the file from my desktop to a spot between the [img]and[/img] but there must be another way because that doesn't seem to do the job. Any more suggestions?
The image tags reference a image available on the public internet by Url. What you need to do is to use the "Upload attachment" tab underneath the edit box, browse to the file on your computer and click the "Add the file" button.
Check the code above that clears up the situation.
Preview shows the pictures in the wrong order. The first shown is the 'After' while the second is the 'Before'.
In looking at some of my old posts I remembered that I had seen this problem before. Here is an excerpt of Trevor's response at that time:
Re: DataGrid Write-Over
by trevordevore » Thu Sep 23, 2010 4:14 am
Prior to LiveCode 4.5 there was a bug that would reset script local variables when you right-clicked on a data grid (and possibly some other actions). This would effectively wipe out the data in the data grid as the data is stored in a script local variable which might lead to what you are seeing. LiveCode 4.5 fixes this though.
I am using Version 4.6.2 of Live Code and this may have begun when I changed to that version. However I have gone back to try the application in 4.5, 4.5.2 and 4.6 and in every case the problems appears to be the same. I do know that for a good portion of 2011 this problem was not something that I saw or I would have asked sooner.