[SOLVED] DBCombobox in DBGrid - What am I missing? lazarus / 16-Databases ---------------------------------------------------------------------- fmc · 2019-10-28 16:31 In the FormActivate, I have: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   DM1.DS_UnitComboBox.DataSet := DM1.ZQ_UnitComboBox;  DM1.ZQ_UnitComboBox.Connection := DM1.ZConn  RxUnitComboBox.DataSource := DM1.DS_UnitComboBox;   with RxUnitComboBox do  begin    DataField := 'inventory_unit';    Visible:= False;  end; For the DBGrid, I have: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm_Neo.RxDBGrid_AddItemsSelectEditor(Sender: TObject;  Column: TColumn; var Editor: TWinControl);begin  try    if Column.FieldName = RxUnitComboBox.DataField then      begin        Editor := RxUnitComboBox;      end;  except    On e: Exception do       MessageDlg('Error during TForm_Main.DBGrid_AddItemsSelectEditor event: ' +                         e.Message, mtWarning,[mbOK],0);  end;  Editor.BoundsRect := RxDBGrid_AddItems.SelectedFieldRect;end; For the DBCombobox (Style := csDropDown): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm_Neo.RxUnitComboBoxKeyPress(Sender: TObject; var Key: char);begin  if key = #13 then    try      if RxDBGrid_AddItems.SelectedIndex + 1 < RxDBGrid_AddItems.Columns.Count then        RxDBGrid_AddItems.SelectedIndex := RxDBGrid_AddItems.SelectedIndex + 1;    except      On e: Exception do        MessageDlg('Error during TForm_Neo.RxUnitComboBoxKeyPress event: ' +                         e.Message, mtWarning,[mbOK],0);    end;end;And I get no DBCombobox in the DBGrid. I can enter data in the cell and it gets saved. But I just don't get the DBCombobox. But, if I change the DBGrid code to Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm_Neo.RxDBGrid_AddItemsSelectEditor(Sender: TObject;  Column: TColumn; var Editor: TWinControl);begin  try    if Column.Field = RxUnitComboBox.Field then  // NOTE THE CHANGE TO THIS LINE      begin        Editor := RxUnitComboBox;      end;  except    On e: Exception do       MessageDlg('Error during TForm_Main.DBGrid_AddItemsSelectEditor event: ' +                       e.Message, mtWarning,[mbOK],0);  end;  Editor.BoundsRect := RxDBGrid_AddItems.SelectedFieldRect;end; then I get a DBCombobox in the Grid. But it accepts no data. No matter what I type in it, it gets wiped out when I exit the cell. ---------------------------------------------------------------------- fmc · 2019-10-28 16:46 HA! Got it! I had it wired in to the wrong Datasource  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   DM1.DS_UnitComboBox.DataSet := DM1.ZQ_UnitComboBox;  DM1.ZQ_UnitComboBox.Connection := DM1.ZConn  // RxUnitComboBox.DataSource := DM1.DS_UnitComboBox;  RxUnitComboBox.DataSource := DM1.DS_AddItems;  with RxUnitComboBox do  begin    DataField := 'inventory_unit';    Visible:= False;  end;