Difference between revisions of "Autosize / Layout"

From Free Pascal wiki
Jump to navigationJump to search
Line 15: Line 15:
 
   AutoSize:=false; // first reset the counter
 
   AutoSize:=false; // first reset the counter
 
   AutoSize:=true;  // then do one AutoSize
 
   AutoSize:=true;  // then do one AutoSize
 +
 +
The reason for this is, that the size of the window is controlled by the window manager. Some window managers do not allow free resizes. This would result in an endless loop between the LCL and the window manager. That's why AutoSize works only once on controls with Parent=nil.

Revision as of 16:40, 5 January 2008

Anchor Sides

See Anchor Sides.

FAQ

Why does AutoSize not work in the designer properly?

In the designer controls can be dragged around and properties can be set in almost any order. To allow this and avoid possible conflicts, the AutoSizing is not updated on every change at design time.

Why does TForm.AutoSize not work when something changes?

TForm.AutoSize only works once at creation time. After that the size is up to user and the windowmanager. The application can force a resize with the following:

 AutoSize:=false; // first reset the counter
 AutoSize:=true;  // then do one AutoSize

The reason for this is, that the size of the window is controlled by the window manager. Some window managers do not allow free resizes. This would result in an endless loop between the LCL and the window manager. That's why AutoSize works only once on controls with Parent=nil.