[Lazarus] New autosize sucks

zeljko zeljko at holobit.net
Fri Apr 23 10:50:25 CEST 2010


On Friday 23 April 2010 10:17, Mattias Gaertner wrote:

> > 1.It works correct with -dOldAutoSize
>
> Only sometimes, not always, as explained in the FAQ.
>
> > 2.It works correct with Delphi/Kylix
>
> I doubt that it always works, unless OnResize fires too often, even if
> the bounds have not changed.
> See here
> http://docwiki.embarcadero.com/VCL/en/Controls.TControl.OnResize
>
> "Occurs immediately after the control is resized."

Well, I don't know what docs says, just know how it works :)

> > 3.It does not work correct with new autosize.
>
> Formerly the OnResize was often triggered after the LCL did some
> autosizing, so for simple form layouts the above worked sometimes. The
> OnResize is now triggered earlier. I can change it to trigger the event
> later, but as OnResize can trigger new autosizes, it can't be
> guaranteed that it will be the final event.
> The right solution is to use the TStringGrids OnResize.

AFAIK, OnResize() isn't in Delphi order.In Delphi OnResize is triggered after 
OnShow(), with LCL it's triggered before OnShow().
Would be great if all OnResize() are postponed (when real resize is happened), 
and sent all at once when parent and all children are resized (only when form 
is resizing).

>
> I will change the event so that it works for some simple cases,
> but I recommend that you fix your code.

Yes, I'll do that but cannot do it now, I need few days maybe few weeks to 
refactor all forms where I use OnResize().

>
> > I have not enough time to investigate what's wrong but I know that my
> > tstringgrid columns aren't resized in form's OnResize event in case of
> > new autosize.Probably resize events are in opposite order so
> > Form.OnResize is triggered first but children are not resized yet. Yes, I
> > know that you wrote somewhere that we should use OnResize() for each
> > control we want to track, but what should I do now with my project which
> > have > 400 forms, open each form add OnResize to each control I need to
> > resize ?
>
> I know what you mean.
> But also think about the many new forms that are created and the many
> users who wants a reliable and fast LCL. It can not be guaranteed that
> form's OnResize comes after all the children are resized (unless it
> triggers far too often and then we get bug reports). And the later
> OnResize is triggered the more overhead it creates.

Of course that I'm on LCL side, but as I mentioned before - cannot use new 
autosize at the moment , and praying God for OldAutoSize not broken at some 
stage until I refactor my projects.

zeljko




More information about the Lazarus mailing list