Subject Problem with linked datasets and IB_Query.FieldByName in event handlers
Author Christian Gütter
Hi,

I am using IBO in a MDI application. As you can open many MDI children
in such an application, I found it useful to display some information
about the current record in the title bar of the MDI child.

In this context, I have encountered a small problem when using
MasterLinks. If you use the following code in a
TIB_DataSource.OnDataChange event handler of the master query, you
get a unexpected, but logical result when you are scrolling through
the records in browse mode:

CurrentForm.Caption :=
MasterQuery.FieldByName('FieldX').AsString + ' ' +
ChildQuery.FieldByName('FieldY').AsString;

For the master query, the correct value of FieldX is displayed in the
window title bar. But for child query, a wrong value is displayed for
FieldY. I found out that it is always the value that was previously
selected. So if you scroll forwards, the value of the previous record
in the buffer is displayed, and if you scroll backwards, the next
record in the buffer is displayed.

It seems that the OnDataChange event of the master query is triggered
before the data of the child query changes, which seems quite logical
to me.

For me, this leads to the following question:
How can I achieve that the above code is executed only when child and
master query are in sync?


Christia