RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSimpleDataSet.OnCalcFields Event

Occurs when an application recalculates calculated fields.

Pascal
property OnCalcFields: TDataSetNotifyEvent;
C++
__property TDataSetNotifyEvent OnCalcFields;

Write an OnCalcFields event handler to take specific action when an application recalculates calculated fields. A calculated field is one that derives its value from the values in one or more fields in the dataset, sometimes with additional processing. 

OnCalcFields is triggered when: 

A dataset is opened. 

A dataset is put into dsEdit state. 

A record is retrieved from a database. 

When the AutoCalcFields property is true, OnCalcFields is also triggered when: 

Focus moves from one visual control to another, or from one column to another is a data-aware grid control and modifications were made to the record.

Note: When the AutoCalcFields property is true, an OnCalcFields event handler should not modify the dataset (or a linked dataset if it is part of a master-detail relationship), because such modifications retrigger the OnCalcField event, leading to infinite recursion.
If an application permits users to change data, OnCalcFields is frequently triggered. To reduce the frequency with which OnCalcFields occurs, set AutoCalcFields to false.
Warning: When the dataset is the master table of a master-detail relationship, OnCalcFields occurs before detail sets have been synchronized with the master table.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!