Canceling Changes

From RAD Studio
Jump to: navigation, search

Go Up to Modifying Data

An application can undo changes made to the current record at any time, if it has not yet directly or indirectly called Post. For example, if a dataset is in dsEdit mode, and a user has changed the data in one or more fields, the application can return the record back to its original values by calling the Cancel method for the dataset. A call to Cancel always returns a dataset to dsBrowse state.

If the dataset was in dsEdit or dsInsert mode when your application called Cancel, it receives BeforeCancel and AfterCancel events before and after the current record is restored to its original values.

On forms, you can allow users to cancel edit, insert, or append operations by including the Cancel button on a navigator component associated with the dataset, or you can provide code for your own Cancel button on the form.

See Also