I am dynamicaly (at run time) adding controls into a TScrollBox using myScrollBox.AddObject
Now I need to remove all the controls I added to put new ones.
I tryed myScrollBox.Controls.Clear but after I call that function, any control I add are not showing up.
(Warning: I’m new to delphi and Firemonkey)
Here is how I add my objects (this is just a test function)
btn1 : TButton;
intI : Integer;
count := 0;
for intI := 0 to 100 do
btn1 := TButton.Create(self);
btn1.Text := ‘Salut ‘ + IntToStr(intI);
btn1.Parent := scbTaskVariables;
btn1.OnClick := Button1Click;
btn1.Tag := intI * 10;
btn1.Position.Y := intI * 50;
btn1.Position.X := intI * 15;
count := scbTaskVariables.ControlsCount;
The funny thing is that if I place a break point on count := scbTaskVariables.ControlsCount
I can see that ControlsCount goes from 0 to 1 for the first control and then it stays to 1 for the others.
I submitted QC#125440.