On Mon, 5 Apr 2010 10:48:00 +0200 (CEST) Michael Van Canneyt <[email protected]> wrote:
> > > On Mon, 5 Apr 2010, Mattias Gaertner wrote: > > > On Sun, 4 Apr 2010 19:21:00 +0200 (CEST) > > Michael Van Canneyt <[email protected]> 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. I see. I changed a few things: TPanel paints its borders itself and sets AdjustClientRect. This was ignored when no childs were there. I fixed that bug. Now empty panels are autosized to 2,2 (the 1 pixel border). Panels without borders will autosize to 0,0, unless the interface limits this to 1,1 - like the gtk. > 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. AutoSize means: use a nice size - the preferred size. For example a TLabel has no childs. > 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... Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
