I am using Lazarus 0.9.30.2. I have a standard TForm with a standard TStringGrid on it. The string grid has no columns or rows on it at design time. In the Object Inspector the following values are set.
ColCount = 0
Columns = 0
FixedCols = 0
FixedRows = 0
RowCount = 0
I want to add a number of TGridColumns at run time, and have been able to do so but always get a fixed column, which I don't want. I have written code very similar to the sample below to do so. When I compile and run it I get the following.
How do I get rind of the fixed column at run time and just leave the remaining columns?
unit test;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids;
type
TForm1 = class(TForm)
SgGrid: TStringGrid;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
var
GridColumn : TGridColumn;
anIndex : integer;
begin
for anIndex := 0 to 5 do
begin
GridColumn := SgGrid.Columns.Add;
GridColumn.Width := 50;
GridColumn.Title.Caption := 'Col ' + inttostr(anIndex);
end; {for}
end;
end.