TTMSFMXGrid Custom Editor

I want to place a custom editor (TDateEdit) in cells of a TTMSFMXGrid.

I am getting exceptions after the date has been edited.

To reproduce this :

Create a new FMX Application.
Drop a TTMSFMXGrid on the main form.
Add FMX.DateTimeUtils to the uses clause.

Create event handlers :

procedure TForm1.TMSFMXGrid1GetCellEditorType(Sender: TObject; ACol,
  ARow: Integer; var CellEditorType: TTMSFMXGridEditorType);
begin
  CellEditorType := etCustom;
end;

procedure TForm1.TMSFMXGrid1GetCellEditorCustomClassType(Sender: TObject;
  ACol, ARow: Integer; var CellEditorCustomClassType: TFmxObjectClass);
begin
  CellEditorCustomClassType := TDateEdit;
end;

Run the program. Try to edit the date in any cell.

I'm using Delphi Tokyo 10.2 Update 1.

TTMSFMXGrid is v2.3.0.11

We will investigate this as it should normally work. But is unclear why you specify an etCustom type for this as you could simply do this by setting CellEditorType = etDateEdit

Hi Bruno

Perhaps my example wasn't the best, because as you say I could use etDateEdit, which does work.

However I also have some cells that require a time editing facility and also a date&time combination - and unfortunately there is no etTimeEdit built in editor (maybe that could be added as a new feature ?!).

I have found that the same exceptions occur on other custom editors (TDateEdit, TTimeEdit, TTMSFMXDateTimeEdit, TComboBox). The exception occurs after the editing has completed. I've tried to track it down but with no luck. 

Your help would be appreciated.

John

We'll investigate

Hi, 


There is a lot going on when using custom editors. I suggest to take a look at the source code / documentation on how to properly construct a custom editor. There are some events missing that need to be added, and this differs from each editor. For TDateEdit, the construction of the editor is shown in the GetCellDateEdit

Hi,

Your custom class needs to implement the ITMSFMXGridInplaceEditor interface.