Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Events

AfterCancel

property AfterCancel() : TDataSetNotifyEvent;

Write an AfterCancel() event handler to take specific action after an application cancels changes to the active record. AfterCancel() is called by the Cancel method after it updates the cursor position, releases the lock on the active record if necessary, and sets the dataset state to dsBrowse. If an application requires additional processing before returning control to a user after a Cancel event, code it in the AfterCancel() event.

AfterClose

property AfterClose() : TDataSetNotifyEvent;

Write an AfterClose() event handler to take specific action immediately after an application closes a dataset. For example, as a security measure, an application might clear a PASSWORD entry from the Params() property of a database component when the dataset is closed.

AfterClose() is called after a dataset is closed and the dataset state is set to dsInactive.

AfterDelete

property AfterDelete() : TDataSetNotifyEvent;

Write an AfterDelete() event handler to take specific action immediately after an application deletes the active record in a dataset. AfterDelete() is called by Delete after it deletes the record, sets the dataset state to dsBrowse, and repositions the cursor on the record prior to the one just deleted.

AfterEdit

property AfterEdit() : TDataSetNotifyEvent;

Write an AfterEdit() event handler to take specific action immediately after dataset enters edit mode. AfterEdit() is called by Edit after it enables editing of a record, recalculates calculated fields, and calls the data event handler to process a record change.

AfterInsert

property AfterInsert() : TDataSetNotifyEvent;

Write an AfterInsert() event handler to take specific action immediately after an application inserts a record. The Insert and Append methods generate an AfterInsert() event after inserting or appending a new record.

AfterOpen

property AfterOpen() : TDataSetNotifyEvent;

Write an AfterOpen() event handler to take specific action immediately after an application opens the dataset. AfterOpen() is called after the cursor for the dataset is opened and the dataset is put into dsBrowse state. For example, an AfterOpen() event handler might check the system registry to determine the last record touched in the dataset the previous time the application ran, and position the cursor at that record.

AfterPost

property AfterPost() : TDataSetNotifyEvent;

Write an AfterPost() event handler to take specific action immediately after an application posts a change to the active record. AfterPost() is called after a modification, deletion, or insertion is made to a record.

AfterScroll

property AfterScroll() : TDataSetNotifyEvent;

Write an AfterScroll() event handler to take specific action immediately after an application scrolls to another record as a result of a call to the First(), Last(), MoveBy(), Next(), Prior(), FindKey(), FindFirst(), FindNext(), FindLast(), FindPrior(), and Locate() methods. AfterScroll() is called after all other events triggered by these methods and any other methods that switch from record to record in the dataset.

BeforeCancel

property BeforeCancel() : TDataSetNotifyEvent;

Write a BeforeCancel() event to take specific action before an application carries out a request to cancel changes. BeforeCancel() is called by the Cancel() method before it cancels a dataset operation such as Edit(), Insert(), or Delete().

An application might use the BeforeCancel() event to record a user's changes in an undo buffer.

BeforeClose

property BeforeClose() : TDataSetNotifyEvent;

Write a BeforeClose() event to take specific action before an application closes a dataset. Calling Close or setting the Active property to False results in a call to the BeforeClose() event handler.

BeforeDelete

property BeforeDelete() : TDataSetNotifyEvent;

Write a BeforeDelete() event handler to take specific action before an application deletes the active record. BeforeDelete() is called by Delete before it actually deletes a record.

Making use of this event an application might, for example, display a dialog box asking for confirmation before deleting the record. On denial of confirmation, the application could abort the deletion by calling the Abort procedure.

BeforeEdit

property BeforeEdit() : TDataSetNotifyEvent;

Write a BeforeEdit() event handler to take specific action before an application enables editing of the active record. For example, an application might keep a log of database edits, and therefore might record the edit request, time, and user in a BeforeEdit() event before entering edit state.

BeforeInsert

property BeforeInsert() : TDataSetNotifyEvent;

Write a BeforeInsert() event handler to take specific action before an application inserts or appends a new record. The Insert or Append method generates a BeforeInsert() method before it sets the dataset into dsInsert state.

BeforeOpen

property BeforeOpen() : TDataSetNotifyEvent;

Write a BeforeOpen() event handler to take specific action before an application opens a dataset for viewing or editing. BeforeOpen() is triggered when an application sets the Active property to True for a dataset or an application calls Open.

BeforePost

property BeforePost() : TDataSetNotifyEvent;

Write a BeforePost() event handler to take specific action before an application posts dataset changes to the database. BeforePost() is triggered when an application calls the Post method. Post checks to make sure all required fields are present, then calls BeforePost() before posting the record.

An application might use BeforePost() to perform validity checks on data changes before posting them to the database. If it encountered a validity problem, it could call Abort to cancel the Post operation.

BeforeScroll

property BeforeScroll() : TDataSetNotifyEvent;

Write a BeforeScroll() event handler to take specific action immediately before an application scrolls to another record as a result of a call to the First(), Last(), MoveBy(), Next(), Prior(), FindKey(), FindFirst(), FindNext(), FindLast(), FindPrior(), and Locate() methods. BeforeScroll() is called before all other events triggered by these methods and any other methods that switch from record to record in the dataset.

OnDeleteError

property OnDeleteError()

Handles exceptions that occur when an attempt to delete a record fails. When OnDeleteError() is first invoked, the Action parameter is always set to daFail. If the error handler corrects the error condition that caused the handler to be invoked, set the Action parameter to daRetry before exiting the handler. When Action is daRetry, the delete operation is tried again. If the error condition cannot be corrected, you can suppress the display of an error message by setting Action to daAbort instead of daFail.

OnEditError

property OnEditError() :

Handles exceptions that occur when an attempt to edit a record fails. When the OnEditError() event handler is first invoked, the Action parameter is always set to daFail. If the error handler corrects the error condition that caused the handler to be invoked, set the Action parameter to daRetry before exiting the handler. When Action is daRetry, the edit operation is tried again. If the error condition cannot be corrected, you can suppress the display of an error message by setting the Action parameter to daAbort instead of daFail.

OnNewRecord

property OnNewRecord() :

Take specific actions as an application inserts or appends a new record. OnNewRecord() is called as part of the insert or append process. An application might use the OnNewRecord() event to set initial values for a record or as a way of implementing cascading insertions in related datasets.

OnPostError

property OnPostError() :

Handles exceptions that occur when an attempt to post a record failed. When OnPostError() is first invoked, the Action parameter is always set to daFail. If the error handler can correct the error condition that caused the handler to be invoked, set the Action parameter to daRetry before exiting the handler. When the Action parameter is set to daRetry, the post operation is tried again. If an error condition cannot be corrected, you can suppress the display of an error message by setting the Action parameter to daAbort instead of daFail.

TOCIndex