Subject | Re: [IBO] TIB_DataSource OnUpdateData |
---|---|
Author | Helen Borrie |
Post date | 2003-05-27T02:15:24Z |
At 08:11 PM 26/05/2003 +0000, you wrote:
called, all column-level and row-level update events are finished. If
nothing has been modified in the dataset, any call to Post will be aborted.
dataset columns, i.e. after Post has been called and/or before any data
columns have been modified.
The datasource will fire OnUpdateData *after* it receives the OnAfterModify
event from the TIB_Column. OnDataChange isn't suitable for column-level
modify activity because it gets called for all data change events in the
control, including those that don't involve modifications to data.
If you want stuff to happen in response to a column's data changing, then
test the dataset's Modified property and trigger what you want from
there. For example, call CalculateFields. Then, in OnCalculateFields,
apply the tests and calculations you want for that event. Just make sure
that you reference the Row here, via the aRow argument. You can target
specific columns using the row's ByName method.
If you want CalculateFields to be called automatically in response to any
field change in the row, set CalculateAllFields true. However, this might
not work for you if you want to intervene in any column-particular events,
since it's "broad-brush" and delivers nil in the aField argument. It's
good if you want to cycle through the column objects in the aRow argument
and respond conditionally according to characteristics of multiple columns.
cheers,
Helen
>Hi,TIB_Column.OnAfterModify is fired immediately after the datasource updates it.
> I want to detect when a particular field of a TIB_Query is updated
>& posted.This is different. Post occurs at dataset level. By the time Post is
called, all column-level and row-level update events are finished. If
nothing has been modified in the dataset, any call to Post will be aborted.
>My TIB_DataSource's OnDataChange occurs too early (beforeIt will be nil whenever there are no pending update notifications from any
>posting) and its OnUpdateData event always seems to have "Field" set
>to null.
dataset columns, i.e. after Post has been called and/or before any data
columns have been modified.
The datasource will fire OnUpdateData *after* it receives the OnAfterModify
event from the TIB_Column. OnDataChange isn't suitable for column-level
modify activity because it gets called for all data change events in the
control, including those that don't involve modifications to data.
>void __fastcall TOrdersForm::OrderSrcUpdateData(TIB_StatementLinkIf Post has already been called, it is too late.
>*Sender, TIB_Statement *Statement, TIB_Column *Field)
>{
> if (Field)
> {
>// NEVER REACHED DESPITE EDITING THIS FIELD IN A GRID & POSTING IT!
> if (Field->FieldName == "ORDER_DATE")
> SuplrQry->CalculateFields();
> }
>}
>
>Why is it so?
If you want stuff to happen in response to a column's data changing, then
test the dataset's Modified property and trigger what you want from
there. For example, call CalculateFields. Then, in OnCalculateFields,
apply the tests and calculations you want for that event. Just make sure
that you reference the Row here, via the aRow argument. You can target
specific columns using the row's ByName method.
If you want CalculateFields to be called automatically in response to any
field change in the row, set CalculateAllFields true. However, this might
not work for you if you want to intervene in any column-particular events,
since it's "broad-brush" and delivers nil in the aField argument. It's
good if you want to cycle through the column objects in the aRow argument
and respond conditionally according to characteristics of multiple columns.
cheers,
Helen