Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid shows empty rows
Message
 
À
06/12/2012 13:09:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01558962
Message ID:
01558968
Vues:
56
>I have a form with a grid. The init of the form creates an empty cursor which serves as the grid's recordsource and assigns the appropriate controlsource to each column
>
>CREATE CURSOR myCursor ........ etc
>thisform.get_data()    && populate myCursor
>WITH thisform.mygrid
>     .recordsource = "myCursor"
>     .column1.controlsource = "myCursor.field1"
>                               .
>     .columnN.controlsource = "myCursor.fieldN"
>ENDWITH
>
>There is a timer on the form which fires every two minutes.
>Timer1.timer
>thisform.get_data()
>
>The get_data method rebuilds the data in myCursor
>SELECT myCursor
>ZAP
>SCATTER NAME oRecord MEMO
>
>SELECT blah blah INTO CURSOR crsTemp
>SCAN
>     oRecord.field1 = some value
>     oRecord.fieldN = some value
>
>     INSERT INTO myCursor FROM NAME oRecord
>ENDSCAN
>
>SELECT myCursor
>GO TOP
>thisform.myGrid.refresh
>
>The init method runs fine and all the data is displayed correctly. However, after the timer fires there are times when the grid appears to be empty. I've verified that the cursor actually has data and that the grid's recordsource and column controlsources are correct.
>
>If I simply press a down-arrow key the data in the grid appears and I'm at record 2.
>
>I've found two different work-arounds to get the behavior I need
>
>1. I changed my code to put the GO TOP after the grid refresh
>
>2. At the beginning of the get_data method I move the focus away from the grid and then set the focus back to the grid at the end of the method.
>
>This obviously isn't urgent since I've found work-arounds, but I am still curious.
>
>Does anybody have an explanation as to why the data in grid doesn't show under my original code? Is this desired behavior? Is it a known anomoly (that I've run into for the first time because I've almost always refreshed data as a result of a button press that set focus outside the grid)
>
>Thanks to all...........Rich

Why not INSERT directly?
SELECT myCursor
ZAP
INSERT INTO myCursor (field1, field2, ..., fieldN);
SELECT blah blah FROM ...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform