setare7sky
سه شنبه 10 اردیبهشت 1387, 10:13 صبح
سلام
من کد زیر رو نوشتم که می خوام tab های یه pagecontrol رو زمان اجرا ایجاد کنم و بعد روش یه سری label بذارم . ولی بعد از ساختن tab ها ، label ها رو روش نمی ذاره . مشکل هم توی تشخیص parent است .
procedure TFTablo.FormCreate(Sender: TObject);
var
i:integer;
begin
adsType.Active:=true;
for i:=0 to adsType.RecordCount-1 do
with TTabSheet.Create(Self) do
begin
PageControl := PageControl1;
Name:='tsh'+IntToStr(i);
PageIndex:=i+1;
Caption := adsType.Fields[1].AsString ;
with TScrollBox.Create(self) do
begin
Name:='sb'+IntToStr(i);
Align:=alClient;
with TLabel.Create(self) do
begin
parent:=TScrollBox.findComponent('sb'+IntToStr(i)) ;
Left :=100;
Top := 0 ;
Caption := 'تست' ;
BringToFront;
end;
end;
adsType.Next;
end;
end;
من کد زیر رو نوشتم که می خوام tab های یه pagecontrol رو زمان اجرا ایجاد کنم و بعد روش یه سری label بذارم . ولی بعد از ساختن tab ها ، label ها رو روش نمی ذاره . مشکل هم توی تشخیص parent است .
procedure TFTablo.FormCreate(Sender: TObject);
var
i:integer;
begin
adsType.Active:=true;
for i:=0 to adsType.RecordCount-1 do
with TTabSheet.Create(Self) do
begin
PageControl := PageControl1;
Name:='tsh'+IntToStr(i);
PageIndex:=i+1;
Caption := adsType.Fields[1].AsString ;
with TScrollBox.Create(self) do
begin
Name:='sb'+IntToStr(i);
Align:=alClient;
with TLabel.Create(self) do
begin
parent:=TScrollBox.findComponent('sb'+IntToStr(i)) ;
Left :=100;
Top := 0 ;
Caption := 'تست' ;
BringToFront;
end;
end;
adsType.Next;
end;
end;