Subject Re: [IBO] Recursive call of TIB_LookupCombo.OnChange
Author H.Klomann
Hi Gabriel,

the OnChange event will occur by various actions,
eg. browsing,insert,update eg. The result will be, that
your query allways goes in editMode when browsing and FieldValue
changes.

A better solution would be to make your field updates here :

procedure TForm1.QryBeforePost(IB_Dataset: TIB_Dataset);
begin
if IB_Dataset.State in [dssInsert,dssUpdate] then begin
if Qry.FieldByName('LOOKUP_FIELD').OldAsVariant <>
Qry.FieldByName('LOOKUP_FIELD').AsVariant then begin
Qry.FieldByName('SOME_FIELD').AsInteger := 1;
end
end;
end;


Harald



Gabriel Juncu schrieb:
>
> Hi List,
>
> I'm using IBO 4.2Fn and Delphi 6 and the following simple app:
> Two TIB_Querys: Qry and LookupQry, and a TIB_LookupCombo connected to

> LookupQry and updating Qry. Everything works ok until:
> In LookupCombo.OnChange event, I put the following statement:
>
> Qry.FieldByName('SOME_FIELD').AsInteger := 1; //example only
> Note that SOME_FIELD is DIFFERENT from the field the LookupCombo updates;
>
> >From now on, I can't change the value in LookupCombo anymore. With the
> debugger I saw that asigning a value to any field of Qry inside OnChange
> event produces a recursive call to LookupCombo.OnChange!
>
> Is there any way that I can assign a value to a Qry's field in the OnChange
> event of the LookupCombo? (LookupQry contains some default values for some
> fields in Qry, so when a user chooses a value in the Lookup , some other Qry fields
> must be filled with the default values that the user can change afterwards).
>
> Thank You!
> Gabriel
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/