Witam.
Poznaje tajniki dynamicznego tworzenia komponentów i trafiłem na problem...
W ramach testów stworzyłem sobie formę z jednym panelem
W FormCreate
wklepałem:
procedure TForm1.FormCreate(Sender: TObject);
begin
WITH TButton.Create(Self) DO // TOWRZENIE PRZYCISKU NA ISTNIEJĄCYM PANELU
begin
Parent:=Panel1;
Caption:='TEST_1';
Left:=100;
Top:=100;
Width:=200;
Height:=200;
Name:='button_test_1';
Visible:=true;
end;
WITH TPanel.Create(Self) DO // TWORZENIE PANELU
begin
Parent:=Form1;
Left:=0;
Top:=0;
Width:=400;
Height:=400;
Name:='PANEL';
Caption:='';
Color:=$0048BD63;
end;
WITH TButton.Create(Self) DO // TOWRZENIE PRZYCISKU NA STWORZONYM PANELU
begin
Parent:=TPanel(FindComponent('PANEL'));
Caption:='TEST_2';
Left:=100;
Top:=100;
Width:=200;
Height:=200;
Name:='button_test_2';
Visible:=true;
end;
end;
Z tego co rozumiem powinien się utworzyć button na istniejącym panelu (tak się dzieje), nowy panel (to też działa) oraz przycisk na nowym panelu (przycisk się tworzy ale jest nie widoczny - jak to zmienić?).