delphidevexpressvcldelphi-10.2-tokyotcxgrid

Delphi Add items to cxcombobox on cxgrid without using oninitpopup event for column


I am having a CXGrid with cxGridTableView, I have some 9 columns out of them some are having cxcomboBox , cxcheckcombobox, cxMemo etc.

The existing grid is Orpheus table and the column is of type TOvcTCComboBox this adds items like this OvcTCComboBox_Name.Items.Add('Name'); How can we achieve this on CXGrid with cxGridTableView

1.  procedure SetCombobox(aCombo: TOvcTCComboBox; sTyp: string; bFirst: Bool; sSpr: string; sRetVal: string);

2.  procedure SetCombobox(aCombo: TCxComboBox; sTyp: string; bFirst: Bool; sSpr: string; sRetVal: string);

I have changed the procedure declaration from 1 to 2 and called the procedure with parameters as below

X_ABCD.SetCombobox(TCXComboBox(OvcTCComboBoxDOSI_Einh_.Properties),'GE',True,DDO_sSPRACHE,'TXT');

Still this is not working, How can this be fixed?

Please help..


Solution

  • To answer your first question, you can use this to add items to a bound grid with a combobox in the first column

      TcxComboBoxProperties(cxGrid1DBTableView1Column1.Properties).Items.Add('Item1')
      TcxComboBoxProperties(cxGrid1DBTableView1Column1.Properties).Items.Add('Item2')
    

    You'll find you can't directly translate your existing SetCombobox function, and so your existing code will be affected