Are we sure that
is never called for anything that changes it's size, regardless of the "AutoSize" property?
E.g. something like the text on a tab of a pagecontrol? Ok, that would have to lead to wrapping or similar, before it affects other components. And then it might trigger resized via other means.
Anyway, another case.
Put a (or several) label (label.autosize := false)
on a panel (panel.autosize = true)
Enable ChildSizing on the panel
LeftToRight
2 per line
no changes to Enlarge../Shrink...
Changing the label.caption will change the size of the label and panel.
Yes, weird... Should it? No idea... But it does. (Laz 2.3)
AutoSizeDelayed Afaik that simply means that some outer caller is holding it back, but that when the execution returns to the outer caller it will be run.
I did some more tests: Added a TPanel (or a TPaintbox for a TCustomControl) and put your ResizeCounter into the OnResize event. Notice that here the counter does NOT increment
Yet, that does not mean that the AutoSize code doesn't run.
In
procedure TControl.Resize;
the OnResize event is only called, if the computation of the AutoSize code actually made changes.
Yet of course, you are right, such checks should be done by any inherited code too.
Especially if that inherited code will cause repainting of the control.
procedure TControl.Resize;
begin
if ([csLoading,csDestroying]*ComponentState<>[]) then exit;
if AutoSizeDelayed then exit;
if (FLastResizeWidth<>Width) or (FLastResizeHeight<>Height)
or (FLastResizeClientWidth<>ClientWidth)
or (FLastResizeClientHeight<>ClientHeight) then begin
..........
DoOnResize;
end;
end;