In my application i work with TLabel objects runtime.
There is a problem: representing a 20 labels takes a lot time (about a 1-2 second).
DoubleBuffered on parent component doesn’t help. Application.ProcessMessages only allows watching for a proccess of creating, instead of looking at frosen window.
// creating a labels in loop
aLabel:=TLabel.Create(scrlbx);
labels.Add(aLabel); // TList for managing.
with aLabel do begin
Left:=pointLeft;
Top:=pointTop;
Caption:='title';
parent:=scrlbx; //TScrollBox
end;
pointTop:=pointTop+20;
Taking parent assigning out of loop to another loop after does some effect, but does’n solve the problem.
for I := 0 to labels.Count-1 do begin
TLabel(labels[i]).Parent:= scrlbx;
end;
Disable and enable TScrollBox.Visible before and aftel loops has no effect.
PS:
Creting of objects doesn’t takes a time.
The bottleneck is parent assigning.
upd: large amount means about 500 items..
Use
ScrollBox.DisableAlignand.EnabledAlign.