Difference between revisions of "LCL Internals - Resizing, Moving"

From Free Pascal wiki
Jump to navigationJump to search
Line 30: Line 30:
 
* YPos := Top
 
* YPos := Top
  
== When a form is maximized, minimized or restored the interface sends ==
+
== When a form is maximized, minimized or restored the interface sends a LM_SIZE message ==
 
 
=== a LM_SIZE message ===
 
  
 
* Width
 
* Width

Revision as of 21:38, 31 July 2007

Overview

The LCL has a lot of resizing properties (Left, Width, Anchors, Align, AnchorSide, AutoSize, Constraints, ChildSizing, ...) and hooks where applications can alter the behavior (OnResize, OnChangeBounds, ...). All these things can not be calculated in one step, so controls can move quite a lot before the final coordinates come out. To reduce flickering the LCL does not send every move/resize to the LCL interface. For example during Begin/EndAlign and csLoading no move/resize is sent to the interface. The widgetset will try to follow the advices of the LCL, but there are some cases, where it does not follow. For example forms (top level windows) are limited by the window manager policies. And TPage completely depends on the size and theme of the TNotebook.

How the LCL tells the interface to resize/move a handle

In TWinControl.DoSendBoundsToInterface the widget function SetBounds is called

 TWSWinControlClass(WidgetSetClass).SetBounds(Self, Left, Top, Width, Height);

How the Interface tells the LCL to resize/move a handle

When a Handle of a TWinControl was resized/moved the interface sends

First the LCL interface send a LM_WINDOWPOSCHANGED message

  • x := Left (relative to 0,0 of client area of parent)
  • y := Top
  • cx := Width
  • cy := Height

Then a LM_SIZE message is sent

  • Width
  • Height
  • SizeType is a bit flag containing Size_SourceIsInterface plus one of the values SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN.

Then a LM_MOVE message is sent

  • MoveType := Move_SourceIsInterface;
  • XPos := Left (relative to 0,0 of client area of parent)
  • YPos := Top

When a form is maximized, minimized or restored the interface sends a LM_SIZE message

  • Width
  • Height
  • SizeType is a bit flag containing Size_SourceIsInterface plus one of the values SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN.

How the LCL gets the current size / position of a LCL interface handle