TTMSFMXGrid and GetCellEditorType

I want my grid to have a button in the editing field.
So I implemented the GetCellEditorType.

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

How can I detect that the Button in the Edit field has been pressed ?
Can I place a specific Text or Image on the button in the Edit field ?

Thanks for any suggestions... 


You can assign an event to the button with
TMSFMXGrid1.CellEditBtn.OnButtonClick := ButtonClick;

Hi Pieter,

Works just fine, thanks.

Can I set more properties this way ?
I tried to set the text for the button and the width, but that didn't seem to work.
TMSFMXGrid1.CellEditBtn.Text := 'MyText';
TMSFMXGrid1.CellEditBtn.Width := 120;


You should normally be able to access the button property, now you are accessing the properties for the edit itself.

Hi Pieter,

You are so right.
But I tried to access the Button itself by using:
But the Button is always NIL.

Do you have an example for me ?
Preferably when setting properties Text, Width and Bitmap for the Button.

Thanks in advance.

The buttton is part of a style and the style is only loaded when the button has a parent. To change properties of the button you need to use the OnApplyStyleLookup event:

procedure TForm1.ApplyEditStyleLookup(Sender: TObject);
  TMSFMXGrid1.CellEditBtn.Button.Width := 40;

procedure TForm1.FormCreate(Sender: TObject);
  TMSFMXGrid1.CellEditBtn.OnApplyStyleLookup := ApplyEditStyleLookup;

Thanks Pieter, it works...

Is there a way to change these settings depending on the Selected Column/Row ?

Yes, you can move the code inside the OnGetCellEditorProperties event.