Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refresh of grid sometimes fails
Message
 
 
À
08/01/2021 16:45:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01677764
Message ID:
01677789
Vues:
67
>Hi all,
>
>I have a read-only grid that users can drag-drop new files into. The files get uploaded to a server and then a requery of the server brings down a new list of the documents (this is done because there is other meta data that is on the documents server that gets displayed).
>
>Problem: occasionally the grid refreshes and instead of showing records, it is blank. If I fire up the debugger, there are actually the correct number of records in the cursor underlying the grid. But the grid shows nothing. If I come back from the debugging tool, this seems to force a refresh of the grid and my records display.
>
>My code: the code that rebuilds the cursor first pulls down the data and inserts it into the cursor (it is a cursor, not a parameterized view as the data actually comes down from the server in xml which is converted first). When that is done, I fire a refresh of the entire page e.g. this code is in the grid:
>
>THIS.Parent.Refresh()
>
>I do this because there are a bunch of buttons associated with the grid that also need their .Refresh() fired as what's in the grid determines their enabled state.
>
>The problem is, this works about 95% of the time - a refresh of the page should refresh every object contained in the page, right? And so it seems to. I am going to insert a refresh of the grid itself just before the .Parent.Refresh() for the page to see if this helps and load that on the customer's server.
>
>But it would be nice to have something more specific - are there instances when VFP refreshes a page but somehow is "lazy" at refreshing a grid because somehow it thinks it does not need to?

Not sure about that, I believe I have seen this once and that was VFP9 SP1. I don't recall if that was only in SP1 or if this was solved in one way or another.
I have usually problems when I have a button on a grid that deletes the current row. Even after a skip a subsequent refresh would keep the deleted row visible. When grids misbehave, I do a refresh using a timer, that would refresh the grid a few milliseconds later, and it usually works much better.

Timer.Enabled = .F.
Timer.Interval = 200

To Refresh the grid:
THISFORM.tmrRefresh.Enabled = .T.

And the TIMER() method of the timer:
THIS.Enabled = .F.
THISFORM.grd.Refresh()
THISFORM.grd.SetFocus()
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform