TTMSFNCDataGrid.Controls Property
Gets or sets the embedded control assigned to the specified cell.
API unit family: TMSFNCDataGrid
Declaring type: TTMSFNCDataGrid
Inherited from: TTMSFNCCustomDataGrid
Type: TTMSFNCDataGridCellControl
Syntax
property Controls[AColumn, ARow: Integer]: TTMSFNCDataGridCellControl;
__property TTMSFNCDataGridCellControl* Controls[int AColumn][int ARow] = {read=GetControl, write=SetControl};
Usage examples
Embed buttons and progress bars inside grid cells
Drop live FMX/VCL controls into specific cells, control alignment and position, and add data-driven progress bars / checkboxes.
procedure TForm1.FormCreate(Sender: TObject);
var
b: TButton;
i: Integer;
begin
Grid.BeginUpdate;
try
Grid.ColumnCount := 8;
Grid.LinearFill;
// Embed live FMX buttons in selected cells.
b := TButton.Create(Self);
b.Text := 'Client';
Grid.Controls[4, 1] := b;
Grid.ControlAligns[4, 1] := gcaClient; // fills the cell
b := TButton.Create(Self);
b.Text := 'Top Right';
Grid.Controls[2, 2] := b;
Grid.ControlPositions[2, 2] := gcpTopRight; // anchored at top-right
// Built-in progress bar bound to the cell value.
Grid.AddDataProgressBar(0, 5);
Grid.Ints[0, 5] := 25;
// Whole-column data-bound checkbox / radio button columns.
Grid.AddDataCheckBoxColumn(5);
Grid.AddRadioButtonColumn(6);
for i := 0 to Grid.RowCount - 1 do
Grid.Booleans[5, i] := Random(2) = 0;
finally
Grid.EndUpdate;
end;
end;
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Grid->BeginUpdate();
try
{
Grid->ColumnCount = 8;
Grid->LinearFill();
// Embed live FMX buttons in selected cells.
TButton *b = new TButton(this);
b->Text = "Client";
Grid->Controls[4][1] = b;
Grid->ControlAligns[4][1] = gcaClient; // fills the cell
b = new TButton(this);
b->Text = "Top Right";
Grid->Controls[2][2] = b;
Grid->ControlPositions[2][2] = gcpTopRight; // anchored at top-right
// Built-in progress bar bound to the cell value.
Grid->AddDataProgressBar(0, 5);
Grid->Ints[0][5] = 25;
// Whole-column data-bound checkbox / radio button columns.
Grid->AddDataCheckBoxColumn(5);
Grid->AddRadioButtonColumn(6);
for (int i = 0; i < Grid->RowCount; i++)
Grid->Booleans[5][i] = (Random(2) == 0);
}
__finally
{
Grid->EndUpdate();
}
}