While the user edits a client dataset, you may find it useful to provide feedback about the edits that have been made. This is especially useful if you want to allow the user to undo specific edits, for example, by navigating to them and clicking an "Undo" button.
The UpdateStatus method and StatusFilter properties are useful when providing feedback on what updates have occurred:
UpdateStatus indicates what type of update, if any, has occurred for the current record. It can be any of the following values:
procedure TForm1.ClientDataSet1CalcFields(DataSet: TDataSet); begin with ClientDataSet1 do begin case UpdateStatus of usUnmodified: FieldByName('Status').AsString := ''; usModified: FieldByName('Status').AsString := 'M'; usInserted: FieldByName('Status').AsString := 'I'; usDeleted: FieldByName('Status').AsString := 'D'; end; end; end;
void __fastcall TForm1::ClientDataSet1CalcFields(TDataSet *DataSet) { switch (DataSet->UpdateStatus()) { case usUnmodified: ClientDataSet1Status->Value = NULL; break; case usModified: ClientDataSet1Status->Value = "M"; break; case usInserted: ClientDataSet1Status->Value = "I"; break; case usDeleted: ClientDataSet1Status->Value = "D"; break; } }
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|