Subject Re: [IBO] TIB_LookupCombo Problem
Author Helen Borrie (TeamIBO)
At 05:28 PM 18-02-02 +1100, you wrote:
>Hello,
>
> I have a OnChange Event in my LookupCombo which initializes a couple of
>different fields in the dataset depending on the lookup value.
> The problem is that the user will change the field in the LookupCombo
>control, which fires-up the OnChange event, which initializes different
>fields in the same dataset, which (here's the problem) resets the value
>in the LookupCombo to the value before the change. If I don't initialize
>the fields in the OnChange, then everything works.

It's not clear to me from your description but are you describing changes in the lookup dataset or in the linked parent?

Remember that, in native IBO, the data drives the controls, not the reverse as in the VCL. If you want to change values in the parent in response to a selection in the lookup, place your code on the TIB_Column.AfterModify event of the linked parent column that is getting modified by the lookupcombo.

If you really are letting the user change values in the lookup dataset, applying the concommittant changes in the TIB_Column.AfterModify event of the lookup column that gets changed is certainly preferable to trying to synchronise the behaviour of the control with the state of the data; but I regard changing lookup data interactively within the same transaction as the parent's edit as "flaky". I'd rather keep the main edit and lookup dataset in the one ReadCommitted transaction and effect any changes to he lookup dataset by way of an ib_dsql....


regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com