Home > Back-end >  Delphi xe5 how to delete has been dynamically created in the Android platform components, everybody
Delphi xe5 how to delete has been dynamically created in the Android platform components, everybody

Time:10-07

Delphi xe5 how to delete has been dynamically created in the Android platform components, everybody masters help to look at, this piece of code where there is not right? Why run the second press the button the program will automatically exit;

The code is as follows:
Procedure TForm4. Button3Click (Sender: TObject);
Var
I: integer;
ScrollboxA: Tscrollbox;
PanelD: Tpanel;
The Begin
For I:=downto ComponentCount - 1 0 do
The begin
If (Tscrollbox (Components [I]). The Name='ScrollBox1') Then
Tscrollbox (Components [I]). Free;
end;

ScrollboxA:=Tscrollbox. Create (form4);
ScrollboxA. Name:='ScrollBox1';
ScrollboxA. Position. : X=184;
ScrollboxA. Position. : y=112;
ScrollboxA. Width:=641;
ScrollboxA. Height:=420;
ScrollboxA. Parent:=form4;

For I:=1 to 5 do
The begin
PanelD:=Tpanel. Create (Self);
With panelD do
The begin
Name:='panels' + InttoStr (I + 1);
Parent:=scrollboxA;
Height:=89;
Align:=TAlignLayout. AlTop;
end;
end;

end;

CodePudding user response:

165232328

Look into this group, have a master can solve, XE5 are also used

CodePudding user response:

For I:=downto ComponentCount - 1 0 do
The begin
If (Tscrollbox (Components [I]). The Name='ScrollBox1') Then
Tscrollbox (Components [I]). Free;
end;

ScrollBox1 the code above is only free, but the Panel in the ScrollBox1 exists, if again by pressing the Button will be repeated to create a Panel,
  • Related