I am developing a program that calculates the averages of some datas in different TStringGrid
and I thought to use a procedure. It is called calcola
.
procedure calcola(numero:ShortInt; StringGrid:TStringGrid; pbarprog:ShortInt);
var i,j,cont,num:shortint;
avg,temp,numfl:double;
a:string;
Edit1:TEdit;
begin
if StringGrid.Colcount>1 then
//other code
avg:=temp/cont;
TLabel(FindComponent('Label'+IntToStr(num))).Caption:=FloatToStrF(avg, ffGeneral, 1, 1);
Edit1.Text:=FloatToStr(StrToFloat(TLabel(FindComponent('Label'+IntToStr(num))).Caption)*10);
TProgressBar(FindComponent('ProgressBar'+IntToStr(i+pbarprog))).Position:=StrToInt(Edit1.Text);
//other code
end;
end;
end;
In this procedure Lazarus tells me "Identifier not found FindComponent". Then I cut/pasted the same code in procedure TForm1.Button1Click(Sender: TObject);
and I had no errors.
I need to use FindComponent()
inside calcola
, how could I do it?