Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread How to create columns at runtime for a data grid? (2.06)
Fri, Jun 1 2018 7:30 PMPermanent Link

jdforce

Avatar

Would like to create / remove grid columns at runtime and assign the corresponding data field.

However the grid component does not seem to have the "columns" property stated on the documentation.

Well, I was thinking of something like Grid1.columns.add but have tried a number of similar "ala delphi" commands without success.
Will be glad of some example please.

JD
Sat, Jun 2 2018 5:40 AMPermanent Link

Uli Becker

> Will be glad of some example please.

....
var
   TempColumn: TGridColumn;
begin
   TempColumn := TGridColumn.Create(Grid1);
   with TempColumn do
   begin
      ControlType := ctEdit;
      DataColumn := 'Field1';
      Alignment := caCenter;
      Index := 0;
      Width := 150;
      ...
   end;
end;

Uli
Sat, Jun 2 2018 7:04 AMPermanent Link

Ralf Mimoun

TGrid.NewColumn Smile


jdforce wrote:

Would like to create / remove grid columns at runtime and assign the corresponding data field.

However the grid component does not seem to have the "columns" property stated on the documentation.

Well, I was thinking of something like Grid1.columns.add but have tried a number of similar "ala delphi" commands without success.
Will be glad of some example please.

JD
Sat, Jun 2 2018 12:04 PMPermanent Link

jdforce

Avatar

Thanks guys.
Image