This is the original TControl.DoRealign :
procedure TControl.DoRealign;
begin
if not FNeedAlign then
Exit;
AlignObjects(Self, FPadding, FSize.Width, FSize.Height, FLastWidth, FLastHeight, FDisableAlign);
end;
but I think it should be written like
procedure TControl.DoRealign;
var aSize: TpointF;
begin
aSise := Size.Size;
if not FNeedAlign then
Exit;
AlignObjects(Self, FPadding, FSize.Width, FSize.Height, FLastWidth, FLastHeight, FDisableAlign);
if not aSize.EqualsTo(Size.Size) then DoRealign;
end;
because often we assign some event to some control onresize (like TText with autosize=True) to resize their parentcontrols to the same size as them. But in this way the problem is that if we resize the parentcontrol during it’s dorealign process then it will not call again dorealign
Did i get it well or did i miss something ? or is their a better way to make a parent control to fit the size of it’s childreen by assigning onresize to them ?