[Lazarus] New autosize is better than me

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Apr 24 10:32:50 CEST 2010


On Fri, 23 Apr 2010 20:34:47 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> Mattias Gärtner schrieb:
> 
> > 1. If the bounds are changed after the form became visible, you will see 
> > flicker. Some widgetsets/windowmanagers combines them and you can not 
> > see it. I heard that this is often the case under windows. But see 
> > Martin's Mail, he sees every window move as flicker. Maybe that is why 
> > the VCL didn't fix it. That's why OnResize comes before OnShow in LCL.
> 
> I understand that window creation is a somewhat special case. It could 
> be solved in special handling of the Visible property, that should be 
> honored only after any other initialization. I.e. Visible could be 
> decoupled from Show, indicating the *designed* state, to be honored when 
> nothing else is left to do.

Visible is even in the VCL decoupled. The VCL also tries to delay
turning a form visible, by using the variable "Showing".
The problem is that this attribute is updated by UpdateShowing which
is triggered to early by some properties (e.g. WindowState). This is ok
for the VCL which internals are optimized for the winapi.
The LCL needed a better approach. Now UpdateShowing is no longer
triggered immediately.

 
> > 2. OnResize is often used to resize controls. So triggering it after 
> > real resize would trigger another real resize. That would cause flicker.
> 
> That's why I suggested a two-pass resize. I have no idea how it would 
> affect Delphi compatibility, though. OnResize could be split into two 
> handlers, OnBeforeResize (or OnQueryResize) and OnAfterResize, called in 
> either pass. When only a single OnResize handler exists, it will be 
> called in both passes, but programmatical changes to the size should be 
> ignored in the second pass.

OnResize is a very important event. See the mails from zeljko. It now
works somewhat like OnAfterResize, which should be quite Delphi
compatible.

The name OnAfterResize would be misleading. It was always triggered
after the control was resized. But for Delphi compatibility it should
be triggered after all other have reacted to this resize. That's not
even true for Delphi, but that is how a lot of code uses it.


Mattias
 




More information about the Lazarus mailing list