[fpc-pascal] Using StrindGrid

John & Marg Sunderland jmsund at netspace.net.au
Fri Jan 15 02:11:08 CET 2010


berna uyan?k wrote:
> Hi,
> I started lazarus newly
> Codes that I used is below:
> unit Unit1;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
> Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, 
> Dialogs,
> Grids;
>
> type
>
> { TForm1 }
>
> TForm1 = class(TForm)
> grid1: TStringGrid;
> procedure FormCreate(Sender: TObject);
> private
> { private declarations }
> public
> { public declarations }
> end;
>
> var
> Form1: TForm1;
>
> implementation
>
> { TForm1 }
>
> procedure TForm1.FormCreate(Sender: TObject);
> var satir: integer;
> sutun:integer;
> begin
> for sutun:=1 to grid1.ColCount do;
Try
for sutun:=0 to grid1.ColCount - 1 do .....

grid rows and cols are 0 indexed, so if you have 3 cols, they are 
numbered from 0 to 2, not 1 to 3.

You will find this in lots of places.

cheers,

John Sunderland



More information about the fpc-pascal mailing list