Sorry please disregard my earlier post about a listview editor
HI I have a TTMSFMXGrid, which is not bound to a dataset (the data is generated at runtime) and I would like to have one of the columns as a combobox, however I can't find a way to populate the individual cells with DIFFERENT data; this:
TTMSFMXGrid1.Columns[1].ComboItems:=User_Record.PrivUserRoles;
Populates each cell in the column with the same data.
Could anyone point me in the right direction?
I've tried to search on these forums but I get an SQL error .
Thanks
Hi,
You can use the OnGetCellEditorProperties to fetch the correct values for each column.
Hi,
Thanks that does work, but its only when the cell is clicked, is there any way to pre=populat the cells at run time?
Thanks
Anthony
Pre-populating ComboItems should work as these items are assigned in the OnGetCellProperties.
When using the following code:
TMSFMXGrid1.Columns[1].Editor := etComboBox;
TMSFMXGrid1.Columns[1].ComboItems.Add('Item 1');
TMSFMXGrid1.Columns[1].ComboItems.Add('Item 2');
TMSFMXGrid1.Columns[1].ComboItems.Add('Item 3');
TMSFMXGrid1.Columns[2].Editor := etComboBox;
TMSFMXGrid1.Columns[2].ComboItems.Add('Value 1');
TMSFMXGrid1.Columns[2].ComboItems.Add('Value 2');
TMSFMXGrid1.Columns[2].ComboItems.Add('Value 3');
The items are displayed correctly.
Hi Thank you for the very prompt reply. This does indeed work; however each cell in the column still has the same values. I'm looking for each cell to have a different set of drop down values.
Thanks
Anthony
Hi,
This is not possible unless you override the default implementation as explained in the previous post through the OnGetCellEditorProperties. You could maintain a list of cell values separately, and load them once, then re-use the lists for each cell overriding the OnGetCellEditorProperties