The ComboBoxIndex is picked based on the Cell-Value i guess?
I tried to set the ComboBoxIndex within TMSFNCDataGrid1GetInplaceEditorProperties but this does not have any effect.
You can easily check this with you "Basic-Editing"-Demo. I changed the GetInplaceEditorProperties-Code to set the Index of the ComboBox to a specific value:
if AInplaceEditorType = getTrackBar then
(AInplaceEditor as TTMSFNCDataGridTrackBar).Max := 3000
else if AInplaceEditorType = getComboBox then
(AInplaceEditor as TTMSFNCDataGridComboBox).ItemIndex := 1;
Excpectation: ComboBoxIndex is set to 1 (which would be in this case "Audi").
But it is always the entry Selected in the ComboBox, that is in the cell. (In my case with abbreviations in the GridCell, the ComboBoxIndex on opening is always -1).
So what happens is that in the OnGetInplaceEditorProperties, the setting of ItemIndex does not have any effect, because after this event, there is another event that transfers the value from the cell to the editor. The event is called OnCellEditGetValue, overriding the value used inside the combobox, so you can use
procedure TForm1.TMSFNCDataGrid1CellEditGetData(Sender: TObject;
ACell: TTMSFNCDataGridCellCoord; AInplaceEditor: TTMSFNCDataGridInplaceEditor;
var AValue: TTMSFNCDataGridCellValue);
begin
if AInplaceEditor is TTMSFNCDataGridComboBox then
AValue := 'Audi';
end;
Alternatively, after opening the inplace editor you can also use
procedure TForm1.TMSFNCDataGrid1AfterOpenInplaceEditor(Sender: TObject;
ACell: TTMSFNCDataGridCellCoord; AInplaceEditor: TTMSFNCDataGridInplaceEditor;
AValue: TTMSFNCDataGridCellValue);
begin
if AInplaceEditor is TTMSFNCDataGridComboBox then
(AInplaceEditor as TTMSFNCDataGridComboBox).ItemIndex := 1
end;