I've tried what you said, but it won't help.
here is the code, it is the mandelbrot set generator. hope it helps
unit rajz1
uses rajz2
procedure TForm1.Button1Click(Sender: TObject);
var err: integer;
begin
val(edit1.Text,form2.limit,err); //if i change it to rajz2.form, then lazarus will give an error
val(edit2.Text,form2.kx,err);
val(edit3.text,form2.vx,err);
Form2.Show;
Form2.rajzolas;
end;
-------
unit rajz2
TForm2 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
kx,vx,x,y,z,regi_z_x,regi_z_y,uj_z_x,uj_z_y: real;
szamlalo: longint;
procedure rajzolas;
{ public declarations }
end;
var
Form2: TForm2;
i,j, limit: integer;
implementation
{ TForm2 }
procedure TForm2.FormCreate(Sender: TObject);
begin
Width:=Screen.Width;
Height:=Screen.Height;
Image1.Width:=Width;
Image1.height:=Height;
end;
procedure TForm2.rajzolas;
begin;
//limit:=200; <-- if i comment these out, it wont work, bcos the variables dont get the values from
//the other form
//kx:=-1.5;
//vx:=0.5;
for i:=0 to width do
begin;
x:=((vx-kx)/width*i)+kx;
Image1.Refresh;
for j:= -height div 2 to height div 2 do
begin;
y:=((vx-kx)/width*(j));
regi_z_x:=0;
regi_z_y:=0;
counter:=0;
repeat
uj_z_x:=regi_z_x*regi_z_x-regi_z_y*regi_z_y+x;
uj_z_y:=2*regi_z_x*regi_z_y+y;
regi_z_x:=uj_z_x;
regi_z_y:=uj_z_y;
z:=sqrt(uj_z_x*uj_z_x+uj_z_y*uj_z_y);
counter:=counter+1;
until (counter>limit) or (z>2);
Image1.Canvas.pixels[i,j+height div 2]:=counter;
end;
end;
end;