I'm replacing the TMS FMX UI pack with TMS FNC UI pack and there are two missing features in the grid that I would be really grateful if you could add:
- ctSwitch as a column type
- etDateEdit as a cell edit type
thanks!
I'm replacing the TMS FMX UI pack with TMS FNC UI pack and there are two missing features in the grid that I would be really grateful if you could add:
thanks!
Hi,
We will investigate the possibilities.
Hi,
For the switch, you can use the following code:
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFNCGrid1.Columns[1].Editor := etCustom;
end;
procedure TForm1.TMSFNCGrid1CellEditGetData(Sender: TObject; ACol,
ARow: Integer; CellEditor: TControl; var CellString: string);
var
b: Boolean;
begin
if CellEditor is TTMSFNCSwitch then
begin
if TryStrToBool(CellString, b) then
begin
if b then
(CellEditor as TTMSFNCSwitch).State := ssOn
else
(CellEditor as TTMSFNCSwitch).State := ssOff;
end;
end;
end;
procedure TForm1.TMSFNCGrid1CellEditSetData(Sender: TObject; ACol,
ARow: Integer; CellEditor: TControl; var CellString: string);
begin
case ACol of
1: CellString := BoolToStr(((CellEditor as TTMSFNCSwitch).State = ssOn), True);
end;
end;
procedure TForm1.TMSFNCGrid1GetCellEditorCustomClassType(Sender: TObject; ACol,
ARow: Integer; var CellEditorCustomClassType: TTMSFNCGridEditorClass);
begin
if ACol = 1 then
CellEditorCustomClassType := TTMSFNCSwitch;
end;
Something similar can be written for the datepicker, but we'll further investigate the possibilities for integration.
Thank you Pieter!