[Lazarus] Zooming a form

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jun 23 10:00:55 CEST 2016


On Thu, 23 Jun 2016 09:35:15 +0200
Martin Grajcar <maaartinus at gmail.com> wrote:

>[...]also BaseParentClientSize, which gets taken from the actual parent,
> which has zero size at the moment.

...which is a show stopper for right anchoring.

 
>[...]
> BaseBounds/BaseParentClientSize is set when you call SetBounds (e.g.
> > when setting Left, Top, Width, Height).  
> 
> My debugger agrees with you. I don't ask why so complicated. ;)

One part Delphi compatibility, one part flexibility for custom controls.

 
>[...]
> > > The zero-client-size parent is a TPage, but I can't claim it guilty as I
> > > couldn't reproduce my problem in a small example.  
> >
> > Do you mean it does work in a small example, but it does not in your
> > complex application?
> >  
> 
> Exactly. I thought that there might be a bug in TNotebook/TPage leading to
> zero client area, but this isn't the case.

Let's see if I can follow you:
Do you mean, when you set the bounds and anchors of the control the
BaseParentClientSize is 0,0 and Parent.ClientRect has non 0 values?

 
>[...]
> I sort of intentionally did not use it: I use no align and no autosize
> (just anchors), so I though I won't need it.

Without Disable/EnableAlign the AutoSize algorithm kicks in after each
property change. And because anchoring is context sensitive, it is
better to make sure. Also it avoids some overhead, which can load a
form much faster.


>[...]
> However, for the future, I'm curious if there's a simple way of storing
> additional information for a control without subclassing it. Let's say, I
> need to store the *original* font size of *every* control. And I don't want
> to run to any problems when the control gets freed.

There is no LCL-built-in user storage space. You need to use
subclassing or some other objects to store your settings.

Mattias



More information about the Lazarus mailing list