If I don't misunderstand what you want is to compare the original value of the table shown in the grid, with the value after the user changed it in the grid...
If so you can try this:
Code: Select all
PUBLIC paArrayGrid := {} // In the Main.prg
When double click in grid, first read cell value and store in public array:
Code: Select all
Function Grid_2_On_DblClick // Called from Grid_2 OnDblClick
LOCAL nRow := GetProperty ("Form_1" , "Grid_2" , "Value") // Get the number of selected Row with double click
paArrayGrid := GetProperty ("Form_1" , "Grid_2" , "Item" , nRow) // Here i store in the public array the values of all columns to selected row
// don't matter if load from array or table Item have complete row values
// Here is the code that enables the user to change the value of the grid...
Return Nil
When the user changed the cell value and wants to save it, you check if the new value in grid is correct before saved in table...
Code: Select all
Function Save_New_Value
LOCAL nRow := GetProperty ("Form_1" , "Grid_2" , "Value") // assuming it didn't change row when saving the new value
LOCAL aArray_Item := GetProperty ("Form_1" , "Grid_2" , "Item" , nRow)
// I suppose you need compare column 2 to old value stored in public array with new value in aArray_Item
Do Case // or If Else, Switch
Case paArrayGrid [2] == aArray_Item [2]
// action for equal values
Case paArrayGrid [2] <> aArray_Item [2]
// action for different values... Etc.
EndCase
// Here one function to reload / refresh grid data...
Return
Sorry for my bad english or if something I did not understand
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162