Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BeforeRowChange in Grid
Message
 
À
02/02/2005 22:35:15
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
00983340
Message ID:
00983350
Vues:
14
Store a marker for the record the grid is at in the grid's tag property. It could be a recorrd number or key fields from the grid's data source.

The problem with those events is that they only address a column change, so you have to "cache" something to idendify when the row (or record) changes.

The before change method always seemed awkward:) With the afterchange, if there is a problem in the "row" just exited, the app can return to it by the "pointer" in the grid's tag. This code should work in BeforeRowChange:
LPARAMETERS nColIndex
with thisform
if transform(recno())#this.tag
   * The row has changed because the current record number is not 
   * the same as the one stashed in the grid's tag.
   * Should there be a problem with it, go back to the record in the tag
   if .SomeError() && Return to row just exited
      goto val(this.tag)
      * You may need a grid refresh or set focus to reset the highlite
   else && No need to revisit last record
      this.tag=transform(recno()) && Stay put and stash the pointer
      * ,, do new row business
   endif &&Some error
   this.setfocus && Maybe not necessary
else && The column changed, but the row remains the same!
   * do nothing
Endif &&transform(recno())#this.tag 
Endwith &&oform
>Dear All,
>
>I would like to ask your advices on this:
>
>I have a grid to show records of my tables, before row change, it will check for any amendments made in the records, to move to another records.
>
>
>IF This.RowColChange = 1
>  Thisform.changeorder
>ENDIF
>
>
>However, it seems that the grid would not remember the first focus record, i.e., when I switch between 2 pages in a pageframe, when I amend the record of first record in the grid, then move the pointer away from the record by mouse, the beforerowchange event is not firing up...
>
>I think I can use setfocus in Pageframe.Page.Activate, however, there are a lot of things download if I put focus in one of the records, and it seems to download the data twice...
>
>Any other means to solve this problem. Thanks in advance!
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform