Dharmesh Bhagatwala
Dharmesh Bhagatwala

Reputation: 85

How to give name to column and fill data in row in Tgrid created at runtime; (Delphi)

I am new to Delphi Firemonkey using Embarcadero® RAD Studio 10 Seattle. I create at runtime a Tgrid. How can i give name to column and fill data in row ? My code is below.

procedure TForm1.Button1Click(Sender: TObject);
var
  Grid : TGrid;
begin
  Grid := TGrid.Create(Form1);
  Grid.Visible := True;
  Grid.Parent := Form1;
  Grid.Align := Grid.Align.alClient;
  Grid.RowCount := 5;
end;

Upvotes: 0

Views: 562

Answers (1)

Matthias B
Matthias B

Reputation: 1015

If by name you mean the heading that is visible at the top of the column, then:

Each column (which you also have to create) is a TColumn of some kind (for example a TStringColumn). TColumn has a Header property (a string), that you can set, that specifies the string in the header cell of the column.

See http://docwiki.embarcadero.com/Libraries/Seattle/en/FMX.Grid.TColumn.Header

Upvotes: 1

Related Questions