Dear sir,
I would like to embedded the dblookupcombo into the grid. any idea ? Thanks.
First item in the FAQ
When you want to access or use values from other listsource fields used in a TAdvDBLookupComboBox when it is used in a TDBAdvGrid as inplace editor, the appropriate place where to access the dataset field values is from the FormControlEditLink.OnGetEditorValue() event. This event is triggered when the DBAdvGrid is about to be updated with the updated value from the TAdvDBLookupComboBox and thus, at this time, the values for other DB fields in the lookup source can be accessed by accessing the lookup source dataset fields. In the sample, this is done by getting the value for the field ‘Capital’ in the COUNTRY table and storing that field value also in the main TDBAdvGrid in a readonly column.
The code is:
procedure TForm1.FormControlEditLink1GetEditorValue(Sender: TObject;
Grid: TAdvStringGrid; var AValue: string);
var
s:string;
begin
AValue := AdvDBLookupComboBox1.Text;
// get the value from the lookup dataset
s := adotable2.FieldByName(''Capital'').AsString;
// store the value in the main dataset
adotable1.FieldByName(''Capital'').AsString := s;
end;
Sample code:
https://download.tmssoftware.com/download/advdblookupcomboboxindbadvgrid.zip
I cannot see any lookupcombo in the grid .... I need to have lookupcombo inside the grid in the first column.
pls advise. Thanks
Please look at the demo, a TAdvDBLookupComboBox is used for the column "Country Name"!
Now ok. Thanks.
BTW, how to add a button in a column so that it can allow user to click button..thanks.
set grid.Columns[COL].Editor = edButton