How can I determine if a TTMSFMXGrid changed?

I'm using c++ and Tokyo.  How can CloseQuery() determine if a TMSFMXGrid changed? I tried OnCellsChanged but that doesn't trigger until after CloseQuery() runs. Preferably, I'd like to know which cell or at least which row changed.  Thanks.

You can  set a flag that the grid was modified from the event OnCellEditValidateData that is triggered whenever the user changes data in the grid.

I tried OnCellEditValidateData but is has the same problem as
OnCellsChanged and OnCellEditSetData.  If I enter something into a cell
and then click exit, CloseQuery() runs before either
OnCellEditValidateData, OnCellEditSetData or OnCellsChanged.  If I set
breakpoints at OnCellsChanged, OnCellEditValidateData and "return 0" in
FMXmain(), FmxMain exits before the FMXGrid events run.

What does the bool FmxGrid->Editing field indicate?  I didn't see anything about it in the documents

TMSFMXGrid.Editing is true when there is still an inplace editor active.

You can programmatically force the inplace editing to stop by calling TMSFMXGrid.StopEdit.

Calling TMSFMXGrid.StopEdit() from CloseQuery() works.  StopEdit() triggers a call to OnCellEditSetData which allows detecting the cell edit. Thanks Bruno