Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to stay in a Row in Grid?
Message
De
25/01/1999 15:12:21
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00179756
Message ID:
00179968
Vues:
40
>I overwrite the cursor with SELECT-SQL.
>
>It's as following:
>1. The record is selected in the grid
>2. The optionbutton is pressed
>3. The grid.RECORDSOURCE is set to "". (I cannot change a cursor)
>4. The record in the table is changed for table.keyval = cursor.Keyval
>5. The table is updated
>6. The variable is stored (mControl=Cursor.KeyVal
>7. The new SELECT SQL is made and
>8. The grid gets its Recordsource to "cursor" (and the columns are filled}
>9. And finally the Cursor.KeyVal is located for mControl.

Would you like to change this way? I don't say that it will not work, it probably will but will require something else.
There is another way, safer way to handle grid-cursor. The idea is to base the grid on read-write cursor, and once it's based (i.e. you move all record/controlsource settings to Grid.Init event) you don't change/override it anymore. When you want to update one record, you can do in both table/cursor, i.e. you don't even need to run SELECT at this point. If you want to update whole cursor, then you SELECT into another cursor/array and then ZAP/APPEND/INSERT to grid's cursor. This way it must work.
The difference between these two approaches is that the former one forces VFP to rebuild grid from scratch any time you overwrite grid's recordsource. In most cases it works Ok, but sometimes can give some troubles to come over. The latter way just reduce number of potential problems and it may help in some particular cases (maybe your problem is one of them).
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform