TMSFNCDataGrid click button event

When creating a button column

Grid.Columns[0].&Type:=gcitButton;
Grid.Columns[0].TypeRange:=gcirNormal;
Grid.Columns[0].AddSetting(gcsType);

and creating properties like

procedure TForm.GridGetCellProperties(Sender: TObject; ACell: TTMSFNCDataGridCell);
begin
  if ACell.IsButtonCell then ACell.AsButtonCell.Button.Caption:='Test';
end;

how can I get access to properies in GridCellButtonClick event?

procedure TForm.GridCellButtonClick(Sender: TObject; AColumn, ARow: Integer);
begin
  ACell???
end;

You can access the cell object with

procedure TForm1.TMSFNCDataGrid1CellButtonClick(Sender: TObject; AColumn,
  ARow: Integer);
var
  obj: TTMSFNCDataGridCell;
begin
  obj := TMSFNCDataGrid1.GetCellObjectForCell(MakeCell(AColumn, ARow));
  if obj.IsButtonCell then
    obj.AsButtonCell.Button.Text := 'test';
end;

works fine, thanks…

1 Like

With pleasure