[Lazarus] Autosize behaviour
Michael Van Canneyt
michael at freepascal.org
Mon Apr 5 10:48:00 CEST 2010
On Mon, 5 Apr 2010, Mattias Gaertner wrote:
> On Sun, 4 Apr 2010 19:21:00 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> Hi,
>>
>> In delphi, setting a panel's AutoSize property to 'true' and aligning it to a
>> form edge, makes the panel disappear when the project is run.
>> This is logical, because, if there are no controls on the panel,
>> the needed size is zero.
>
> Yes, and this is the problem. A visible control must not have the size
> 0,0. It makes no sense. This is bad in the designer. The gtk does not
> like it.
> Therefore the LCL ignores the child bounds if no childs are there.
>
>
>> In Lazarus, the panel is still shown.
>>
>> Is this a known bug ?
>
> A feature. You are the first asking. Do you need it?
What is "need"... The current behaviour is definitely not compatible to delphi.
In Delphi, you can make dock zones along the edges of your
form by dropping 4 panels and aligning them along the edges of the form.
If autosize=true, then they have size 0 when the app is run (not when designed),
but you can dock controls on them, since there is a "fuzzy" zone of 10 pixels.
No code is needed, and you can then dock toolbars etc. along the edges of the form.
If lazarus is not compatible:
It means that I must put width/height=0 manually in the IDE (or do this when
the form is created), and enable autosizing as soon as the first control is
docked on the panel, and when a docked control is removed from the panel, I must
put width/height again to zero, manually.
IMHO Autosize should do what it says at runtime, not with exceptions: fit the
children. If there are none: size=0. For aligned, this means just the
dimension which is orthogonal to the aligned dimension: alRight -> width=0.
I agree it is all rather sloppy, but then I think Layouting as a whole is sloppy :-)
Unless someone has a better idea for dock zones around the edge of a form
without having to write code...
Michael.
More information about the Lazarus
mailing list