[Lazarus] Does Lazarus have "sizer" or "layout" objects?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jan 8 02:55:51 CET 2009


Vincent Snijders schrieb:

>> Some C++ class libraries have object classes that automatically resize
>> widgets when a form is resized by the user. For example, wxWidgets calls
>> them sizers, and Qt calls them layouts. I have perused the LCL
>> documentation and have found nothing that quite meets the bill. I tried
>> a TPanel object, but it did not have anywhere near that functionality;
>> in fact, it seemed to do very little.

Delphi at least has Toolbars, with more features than simple TPanels.

>> So, as the subject line says, does Lazarus have such classes?
> 
> No, there are no such classes. A control has anchors, and a number of
> a controls can autosize (i.e. adjust size accoding to their contents).
> 
> For anchoring, see wiki:
> http://wiki.lazarus.freepascal.org/IDE_Window:_Anchor_Editor
> and
> http://wiki.lazarus.freepascal.org/Anchor_Sides

Anchoring is not a useful replacement for other (more systematic) 
layouts. E.g. I found docking impossible with anchors.

IMO we should add more "regular" (rectangular) layout managers to the 
basic controls, not restricted to containers derived from TWinControl. A 
TDockTree with TDockZones were a useful base class for such layout 
managers, provided that it can be implemented as a self contained 
alternative for anchoring. The implementation should not be complicated, 
from the management viewpoint: every layout level covers a rectangular 
zone, which can be subdivided horizontally or vertically into further 
zones, with "leaf" zones containing one control each. It must be 
possible to anchor sliders (beformentioned sizers) to zones, not only to 
controls. Then we can try to integrate the current anchoring into such a 
commonly used, stable and useful layout management.

DoDi




More information about the Lazarus mailing list