[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Controls' (#lcl)

TAnchorSide

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Specifies how the side of a control is anchored to other controls.

Declaration

Source position: controls.pp line 821

type TAnchorSide = class(TPersistent) end;

protected

  function GetOwner; override;

public

  constructor Create();

  destructor Destroy; override;

  procedure GetSidePosition();

  

Get information about the target control, side and side position.

  function CheckSidePosition();

  

Check for anchor cycles and invalid targets, and return information about the target side.

  procedure Assign(); override;

  function IsAnchoredToParent();

  

True when we are anchored to our parent, at least on ParentSide

  procedure FixCenterAnchoring;

  

Remove conflicting anchors.

  property Owner: TControl; [r]

  

The control being anchored.

  property Kind: TAnchorKind; [r]

  

The control side being anchored.

published

  property Control: TControl; [rw]

  

The target control of the anchor.

  property Side: TAnchorSideReference; [rw]

  

The side of the target Control, to which we anchor.

Inheritance

TAnchorSide

  

Specifies how the side of a control is anchored to other controls.

|

TPersistent

?

TObject

Description

TAnchorSide

    Class holding the reference sides of the anchors of a TControl.
    Every TControl has four AnchorSides:
    AnchorSide[akLeft], AnchorSide[akRight], AnchorSide[akTop] and
    AnchorSide[akBottom].
    Normally if Anchors contain akLeft, and the Parent is resized, the LCL
    tries to keep the distance between the left side of the control and the
    right side of its parent client area.
    With AnchorSide[akLeft] you can define a different reference side. The
    kept distance is defined by the BorderSpacing.
    
    Example1:
       +-----+  +-----+
       |  B  |  |  C  |
       |     |  +-----+
       +-----+

      If you want to have the top of B the same as the top of C use
        B.AnchorSide[akTop].Side:=asrTop;
        B.AnchorSide[akTop].Control:=C;
      If you want to keep a distance of 10 pixels between B and C use
        B.BorderSpacing.Right:=10;
        B.AnchorSide[akRight].Side:=asrLeft;
        B.AnchorSide[akRight].Control:=C;

      Do not setup in both directions, because this will create a circle, and
      circles are not allowed.
      
    Example2:
            +-------+
      +---+ |       |
      | A | |   B   |
      +---+ |       |
            +-------+
            
      Centering A relative to B:
        A.AnchorSide[akTop].Side:=asrCenter;
        A.AnchorSide[akTop].Control:=B;
      Or use this. It's equivalent:
        A.AnchorSide[akBottom].Side:=asrCenter;
        A.AnchorSide[akBottom].Control:=B;
The latest version of this document can be found at lazarus-ccr.sourceforge.net.