>How to validate movement from row to row in a grid?
>In BROWSE we have WHEN clause, but in a grid...
>
>May be decision is in usage of BeforeRowColChange and AfterRowColChange events, but it seems that in this events we don't know if movement is from row to row or from column to column.
>
>I decided this problem partially with new property and some checking.
>
>Please help.
>Nik
Nikolay,
I use the afterrowcolchange event, and maintain a property that holds the last row. I check to see if the activerow property of the grid is different from the stored row, if it is then we do something otherwise we ignore it. The code from the afterrowcolchange event follows;
LPARAMETERS ncolindex
IF THIS.ACTIVEROW # THIS.PARENT.lastgridrow
IF odao.isbufferdirty(THIS.RECORDSOURCE,THISFORM.DATASESSIONID)
(NOTE: odao is a global data manipulation object we use throughout)
cmsg = "Save changes to " + ALLTRIM(rvwpubprofile.pubname) + " ?"
nretval = MESSAGEBOX(cmsg ,mb_yesno+mb_iconquestion ;
,"User confirmation required")
DO CASE
CASE nretval = idyes
THISFORM.cmdgridsave.CLICK()
CASE nretval = idno
THISFORM.cmdgridabort.CLICK()
ENDCASE
ENDIF
THIS.PARENT.pubprof.loaddata(rvwvpabclist.ctrl_pubn)
ENDIF
THIS.PARENT.lastgridrow = THIS.ACTIVEROW
There are other ways to do what we're after here, which is to check the buffer of the row in the view and force the user to save or abort changes in the grid.
Regards,
Jason
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage