I have a procedure that needs to be triggered/fired by a user deletion of data in a cell. Looks like ClientDataset.Delete is not appropriate for this case.
My data structure are:
TADOConnection -> TADOQuery -> TDataSetProvider -> TClientDataSet -> TDataSource -> TDBGRidEh (descendant of TDBGrid)
Do I need to create a procedure to detect the deletion or is there already an event or properties ready to use for this purpose?
The code below should detect when a given field -
Customerin this example - of your CDS has been modified so that either its AsString property is an empty string or the Field's value has been set to Null, but, in either case, only if the Field had a non-Null, non-empty value previously.It uses a custom descendant of a TFieldDataLink to do the detection and handle the dsFieldChange event. This will only fire immediately while the
Postmethod is executing and has not yet returned.To use, cut & paste into a new VCL project.
Btw, for a problem like this, it's best to start by looking at it from the point of view of the dataset rather than a particular component like a DBGrid.