[Lazarus] Zooming a form

Martin Grajcar maaartinus at gmail.com
Thu Jun 23 18:02:09 CEST 2016


On Thu, Jun 23, 2016 at 10:00 AM, Mattias Gaertner <
nc-gaertnma at netcologne.de> wrote:

> 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.
>

Yet it works well with my hack saying "don't store parent size".


> >[...]
> > 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?
>

No, exactly the opposite:
BaseParentClientSize.cx = 850
Parent.Width = ParentClientRect.Right = ParentClientRect.Left = 0

So not storing the parent size seems to make sense.

>[...]
> > 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.
>

OK, I keep using DisableAlign.

>[...]
> > 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.


OK, let's forget it for now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160623/1c174a07/attachment-0005.html>


More information about the Lazarus mailing list