Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7567423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:39:40+00:00 2026-05-30T14:39:40+00:00

I am using Lazarus 0.9.30.2. I have a standard TForm with a standard TStringGrid

  • 0

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.

enter image description here

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.                                                                                                                                              
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:39:41+00:00Added an answer on May 30, 2026 at 2:39 pm

    I think it’s such kind of a feature (or bug from another point of view). If you have at design time your string grid empty (0 cols, 0 rows), at runtime when you add a column, the following properties are being set to the default, stored values.

    • TStringGrid.RowCount
    • TStringGrid.FixedRows
    • TStringGrid.FixedCols

    How to workaround it:

    • either set the TStringGrid.FixedCols to 0 at runtime after you add at least one column, for your case simply after when you add all of them

    • or set the TStringGrid.ColCount and TStringGrid.FixedRows to 1 at designtime, you will see the column, but the TStringGrid.Columns collection remains empty, so there’s no need to worry that you will get one extra column at runtime (in Delphi e.g. you can’t even set the column nor row count to 0)

    I’m suspecting the TCustomGrid.AdjustCount procedure, but it’s just a wild guess and off topic here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using android 2.3.3, I have a background Service which has a socket connection. There's
I have a project on Lazarus that I want to compile a source using
I have written a program using Free Pascal and the Lazarus IDE. In brief,
I'm planning on building an application that simplifies web design. I intent using Lazarus/FreePascal
I have managed to use SAPI Text-To-Speech in Delphi/Lazarus by using the following code:
I am using Lazarus v0.9.30 (32 bit compiler). I have the following code that
using php, i have a sql query which works fine, dateentry only has the
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.