[Lazarus] New autosize sucks

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Apr 22 23:36:48 CEST 2010


On Thu, 22 Apr 2010 17:36:36 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> Is it only me, or have more users noticed the many changes, required to 
> make existing code work without -dOldAutoSize?

AFAIK you and me are the only one working on docking.

 
> I understand that it may take some more time to finish the autosize 
> redesign, so let me report some observations:

According to the bug tracker there is only one issue left and no
developer can reproduce it:
http://bugs.freepascal.org/view.php?id=16184

 
> Resize requests occur much too often, eventually causing excessive 
> flicker. 

According to the irc all your windows flickers, not only lazarus forms.


> It's not a good idea to fix this in application code, since 
> this will result in flames like:
> 
>    Delphi applications have a GUI, Lazarus applications a light show.
> 
> It would help to trigger any layout actions only on changes of the Width 
> or Height of a control, and not when e.g. a form only is moved. It's 
> simpler to add an Invalidate or other update statement to existing code, 
> when the GUI or a widgetset fails to reflect changes automatically, than 
> preventing not required changes by fragile pairs of Disable/Enable 
> calls, all over in LCL and application code.

With "resize requests" I guess you mean the ResetBounds. This has been
changed.

 
> Thanks to Mattias for his attempts to reduce the flicker in the docking 
> examples, but I had to drop all modifications to the dockmanager code, 
> in order to make it *work* as before. Flicker and other inconveniences 
> have to be fixed in the LCL, not in user code.

The changes combined the many moves to one. The LCL only does what
your code tells it. You created a visible form and move it several
times in MakeSite.lpi. That causes the flicker.
Some widgetsets/window managers don't like such moves and therefore the
the oldautosize code had some workarounds to ignore some moves. This
made restoring window positions and autosizing unreliable.
The new autosize code does not have this workarounds, so the many
moves are now shown. It dedends on widgetset and windowmanager how much
flickering you see. You can avoid the flickering by
a) set the Visible property to true *after* moving it
b) by using Disable/EnableAutoSizing

 
> Since the new autosize changes broke the dockmanager examples in many 
> ways, I suggest to use them with -dOldAutoSize. Once the general 
> autosize problems have been solved, we can look again at eventual 
> remaining docking-related problems.

The dockmanager examples should be fixed. See my changes you undid.

 
> Last not least let me refrain my opinion about layout managers, that 
> becomes stronger with every new-autosize problem:
> 
> Separate layout management from general LCL code, so that different 
> layout managers (e.g. anchored layouts, docksite layout) can be used 
> *when needed*. This would simplify the development of e.g. new autosize 
> a lot, when only the (default) layout manager must be changed in a 
> project, instead of the currently required rebuild of the entire LCL. 
> This redesign also could reveal many layout (manager) specific hacks, 
> crowding the current Controls unit, that should be removed for two reasons:
> 1) increase the LCL maintainability
> 2) reduce consequently required workarounds in user code

The new autosize code was an important step towards layout
managers. We only need to agree on the events/methods. See the mail
thread two weeks ago.


Mattias




More information about the Lazarus mailing list