FNC Grid TimeEdit editor type

Hello,

I notied that FNCGrid does not support etTimeEdit editor type although it does support edDateEdit.
can you advise a way i am able to use a Time Edit in FNC Grid please?

Thank you
David Royall

Hi,

There is no Time Edit support built in because there are no time editors for every platform. To support this, you'll need to use custom inplace editors:

procedure TForm1.TMSFNCGrid1CellEditGetData(Sender: TObject; ACol,
  ARow: Integer; CellEditor: TControl; var CellString: string);
var
  t: TDateTime;
begin
  if TryStrToTime(CellString, t) then
    (CellEditor as TTimeEdit).Time := t;
end;

procedure TForm1.TMSFNCGrid1CellEditSetData(Sender: TObject; ACol,
  ARow: Integer; CellEditor: TControl; var CellString: string);
begin
  CellString := FormatDateTime('hh:nn:ss', (CellEditor as TTimeEdit).Time);
end;

procedure TForm1.TMSFNCGrid1GetCellEditorCustomClassType(Sender: TObject; ACol,
  ARow: Integer; var CellEditorCustomClassType: TTMSFNCGridEditorClass);
begin
  CellEditorCustomClassType := TTimeEdit;
end;

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

Hello,

Many thanks for the usefull feedback.

welcome!