The following checks to see if the current row has been changed before the user navigates to another row. If changes have been made, an explicit row lock is attempted. If the lock is successful, the date and time of update is recorded in the row, the row is saved and unlocked, and navigation is permitted. If unsuccessful, the user is given a choice as to what to do.

function rowset_canNavigate

if not this.modified 

return true       // No changes, row navigation okay 

endif 

local lReturn, nButton 

lReturn = false 

do 

if not this.lockRow( )   // Try the lock 

nButton = msgBox( "Row is locked by another, keep trying? " + ; 

'("Cancel" discards changes)', ; 

"Cannot Save Changes", 3 + 32 ) 

if nButton = 6 

loop        // User clicked "Yes" (try again) 

endif 

lReturn := nButton = 2 

if lReturn      // User clicked "Cancel" 

this.abandon( ) 

endif 

exit         // Give up 

endif 

lReturn := true 

this.fields[ "UPDATED" ].value := date( ) + " at " + time( ) 

this.save( ) 

this.unlock( ) 

until lReturn 

return lReturn