advice for dbadvgrid

hello,

 
On an dbadvgrid I have one combobox on col 11.
It is linked to FormControlEditLink1;
The FormControlEditLink1 is linked to AdvDBLookupComboBox3.
The AdvDBLookupComboBox3 data source is connected to an IBquery.
It is working well until now.
But now , the sql query in the IBquery needs to change dynamically.according one integer value named COFAM.
So the data in the AdvDBLookupComboBox3 changes according that value.
 
What is the best way to do this ?
I tried to change dynamically the sql query for AdvDBLookupComboBox3 according the value COFAM but the synchronization with the grid is not perfect.
 
Is there any way to do this ?
 
Regards
 
 
 
Here is a part of the code
------------------------------------------------------------------------------------------------------------
procedure TForm3.DBAdvGrid1GetEditorType(Sender: TObject; ACol, ARow: Integer;
  var AEditor: TEditorType);
begin
  AEditor := edNormal;
  DBAdvGrid1.EditLink := nil;
  case Acol of
  11:
  begin
  AEditor := edCustom;
  DBAdvGrid1.EditLink := FormControlEditLink1;
  end;
  end;
end;
------------------------------------------------------------------------------------------------------------
procedure TForm3.FormControlEditLink1GetEditorValue(Sender: TObject;
  Grid: TAdvStringGrid; var AValue: string);
begin
AValue := AdvDBLookupComboBox3.Text;
end;
procedure TForm3.FormControlEditLink1SetEditorValue(Sender: TObject;
  Grid: TAdvStringGrid; AValue: string);
begin
AdvDBLookupComboBox3.Text:=AValue;
end;
----------------------------------------------------

It is not clear when exactly you need to change the query. By what action is this triggered?
Can you also explain with more details what exactly in the synchronization goes wrong?


hello,

Each time the value COFAM changes, I run this code:
 
----------------------------------------------------------------------------------------------------------------------
case COFAM of
9:
begin
IBquery15.close;
IBquery15.SQL.Clear;
IBquery15.SQL.Add('select  MENUDER.MDIDMDER, MENUDER.MDLIBELLE  from MENUDER');
IBquery15.SQL.Add('where MENUDER.MDFAM = ''CS''');
IBquery15.SQL.Add('order by  MENUDER.MDLIBELLE');
Ibquery15.open;
end;
else
begin
IBquery15.close;
IBquery15.SQL.Clear;
IBquery15.SQL.Add('select  MENUDER.MDIDMDER, MENUDER.MDLIBELLE  from MENUDER');
IBquery15.SQL.Add('where MENUDER.MDFAM = ''CH''');
IBquery15.SQL.Add('order by  MENUDER.MDLIBELLE');
Ibquery15.open;
end;
end;
end;
 
The ibquery15 is linked to the AdvDBLookupComboBox3
But it's not running at 100 %
 
I think I should do another action to synchronize with the inside editor ?
 
regards
 
 
 

"each time COFAM changes" .... but when exactly in relationship to grid events does this value change? Are you doing this from a specific grid event handler ? Other place ?