Add button to each row of a column

Hello,


I have a Livegrid. It is connected to a binding list and it has two database fields.
I need to have a small button next to the second cells (in each cell of the second column).

I did this:
MyLiveGrid.Columns[1].Editor := etEditBtn;

but nothing happend.
Please help me:
-to show a button in the column
-to assign an onClick property  to it

Thank you very much!



I modified it:

MyLiveGrid.Columns[1].Editor := etEditBtn;

Now the button appears but I cannot set the caption and the width of the button.
I can see this: "Bu..."

Thank you.


Hi, 


the Editor is only shown once, when editing a cell, either by pressing F2 or by double-clicking on the cell. If you want to display a button, you'll need to use the following code:

TMSFMXGrid1.AddButton(2, 2, 'test');

sorry in my post above I wanted to write:

MyLiveGrid.Columns[1].ColumnType := ctButton;

Hello Pieter,


Thank you for your answer.
If I know well TMSFMXGrid1.AddButton(2, 2, 'test'); adds button to a single cell right? So I need to iterate among all the rows to show the button in each row of a column...

If I want to show the button in each row of a column, 
MyLiveGrid.Columns[1].ColumnType := ctButton;
... is faster to display?

In the latter case how can I set the caption and the width of the button?

Thank you.



That is correct, but the purpose is the same, and you can add text directly via the method AddButton.

When using ctButton however, you need to use the OnGetCellProperties and convert the object to an TTMSFNCButtonGridCell type where you can access the button properties such as text, width etc...

Thank you.