I am using TAD with livebinding
There are situations where I need to cancel the NewObjectUpdate event and revert the editing.
this is what I have now:
procedure TNaharDataSet.NewObjectUpdate(Dataset: TDataSet; AObject: TObject);
begin
if not IsEqualGUID((AObject as TNaharEntity).OwnedBy, NULL_GUID) then
begin
DataSet.Cancel;
DataSet.Refresh;
raise Exception.Create('Voçe não é o dono destas informações')
end
else
begin
Model.SaveOrUpdate(AObject as TNaharEntity);
Model.Flush;
end;
end;
DataSet.Cancel is doing the work to put the dataset back to browse state
But the refresh is not getting the edit value back to the original. Even changing the record and going back again the new value remains there.
How to revert the Editing operation?
Eduardo