I've problem with TMSFNCGrid (with dataset) creating a "delete" button or image for every row.
I try to add a TTMSFNCBitmapGridCell columns. I set OnCellBitmapClick event, but the event doesn't works.
I set in the event OnGetCellClass "CellClassType := TTMSFNCBitmapGridCell;".
I set the cell property in event OnGetCellProperties in this way:
if (ACol = 4) AND (ARow > 0) then
begin
Cell.BitmapContainer := bitmapContainer;
gridTest.CreateBitmap(ACol, ARow);
gridTest.AddBitmap(ACol, ARow, 'plus.svg')
end;
The icons correctly appears, but event "CellBitmapClick" never triggers.
Also, I've set column property "ReadOnly = True" but the editing is still possible (only the type cell TTMSFNCBitmapGridCell).
I will try to insert a TButton instead of a Bitmap; but how I can show a button with an image for every row?
Thanks in advance,
procedure TForm29.TMSFNCGrid1CellBitmapClick(Sender: TObject; ACol,
ARow: Integer; ACell: TTMSFNCGridCell);
begin
console.log('test');
end;
procedure TForm29.TMSFNCGrid1GetCellProperties(Sender: TObject; ACol,
ARow: Integer; Cell: TTMSFNCGridCell);
begin
Cell.ControlEnabled := True;
end;
procedure TForm29.WebFormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 1 to TMSFNCGrid1.RowCount - 1 do
begin
TMSFNCGrid1.AddBitmap(4, I, 'n');
end;
end;
Hi Pieter,
I tried your code and now the event OnCellBitmapClick works, but the bitmap column is still editable.
I set the property "ReadOnly := True" but if I click in cell, the editing is possible.
How can I resolve?
When adding a bitmap cell, or any other property related to cells, overrides the default behavior of a column, which means that the cell will be editable. You can override this again by using: TMSFNCGrid1.ReadOnlys[ACol, ARow] := True;