Double Data in DataGrid

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Double Data in DataGrid

Post by lohill »

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:

Code: Select all

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?

Thanks in advance for any ideas or suggestions,

Larry
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Double Data in DataGrid

Post by lohill »

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]

AFTER
[img]/Users/Larry/Desktop/After.tiff[/img]

My script:

Code: Select all

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
Thanks in advance for any suggestions.
Larry
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Double Data in DataGrid

Post by lohill »

What does it take to make the pictures visible?

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

Re: Double Data in DataGrid

Post by Klaus »

Hi Larry,

try JPEGs!
TIFF is Mac only 8)
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Double Data in DataGrid

Post by lohill »

Hi Klaus,

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?

Larry
SparkOut
Posts: 2987
Joined: Sun Sep 23, 2007 4:58 pm

Re: Double Data in DataGrid

Post by SparkOut »

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.
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Double Data in DataGrid

Post by lohill »

Thanks SparkOut,

Here is another try:
BEFORE
[img]
Before.jpg
[/img]

AFTER
[img]
Before.jpg
[/img]

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'.

Regards,
Larry
Attachments
After.jpg
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Double Data in DataGrid

Post by lohill »

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.

Larry
dglass
Posts: 519
Joined: Thu Sep 24, 2009 9:10 pm
Contact:

Re: Double Data in DataGrid

Post by dglass »

It's possible the data grid has become corrupted in some fashion. You might try to recreate the issue in a new grid.
Post Reply