[Lazarus] Zooming a form

Martin Grajcar maaartinus at gmail.com
Tue Jun 21 04:05:04 CEST 2016


I should zoom a form, so that all its controls (and their fonts) get bigger
by X%. The recursion is trivial and it mostly works, but ...

I'm doing it in a moment when not everything is visible (and can't see how
to postpone it). Despite that, it works fine for all controls with Anchors
= [akLeft, akTop]. For controls with other anchors, nothing works: Even a
trivial change like increasing left or width by one makes the control lose
its anchoring (and behave like left-top-anchored) and move to a strange
position.

The problem seems to lie in TControl.UpdateBaseBounds when
the FBaseParentClientSize gets stored, which happens to be (0, 0) at this
point. If I hack it to keep the previously stored value, it somehow works.

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.

So I wonder:

   - Is it forbidden to change position and/or size of a component when
   it's not shown?
   - If not, how can I deal with right-aligned controls? Simply setting
   c.Left := c.Left * Factor doesn't seem to work (though it should as in this
   step all positions and all sizes simply get scaled up; anchoring is used
   when the parent resizes and not the component itself, right?).

But actually any help is appreciated.

I'm stuck with Lazarus 1.4.2, but the trunk code seems to do the same.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160621/38bd8594/attachment-0002.html>


More information about the Lazarus mailing list