Тема: tobjectlist
Допоможіть, писав як в книжці і пише помилку
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics,
FMX.Dialogs, System.Generics.Collections, Contnrs,
FMX.Objects;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Circle1: TCircle;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
list:TObjectList<tcircle>;
circle:Tcircle;
i:integer;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
list:=TObjectList<tcircle>.create;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
randomize;
circle:=tcircle.create(nil);
list.add(circle);
circle.parent:=form1;
circle.position.y:=0;
circle.position.x:=random(round(form1.ClientWidth-circle.width));
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
for I :=0 to list.count-1 do
with list.items[i] do
begin
position.y:=position.y+0.5;
end;
end;
end.