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

TAnchorSide

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

TAnchorSide - the side on which anchoring is to be performed for the current control

Declaration

Source position: controls.pp line 745

type TAnchorSide = class(TPersistent)

protected

  function GetOwner; override;

public

  constructor Create();

  

Create - constructor for TAnchorSide: calls inherited Create, copies arguments to local variables and sets default anchor to Top

  destructor Destroy; override;

  

Destroy - destructor for TAnchorSide: removes all anchoring links then calls inherited Destroy

  procedure GetSidePosition();

  

GetSidePosition - returns the position of the side used for anchoring

  function CheckSidePosition();

  procedure Assign(); override;

  

Assign - copies anchoring information from Source if it is of the same type as the current control, otherwise calls inherited Assign

  function IsAnchoredToParent();

  procedure FixCenterAnchoring;

  property Owner: TControl; [r]

  

Owner - the Control that owns the current control that is to be anchored

  property Kind: TAnchorKind; [r]

  

The Kind of anchoring to be used

published

  property Control: TControl; [rw]

  

The control whose anchoring properties are being determined

  property Side: TAnchorSideReference; [rw]

  

The side on which anchoring is to be performed

end;

Inheritance

TAnchorSide

  

TAnchorSide - the side on which anchoring is to be performed for the current control

|

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:=arsCenter;
        A.AnchorSide[akTop].Control:=B;
      Or use this. It's equivalent:
        A.AnchorSide[akBottom].Side:=arsCenter;
        A.AnchorSide[akBottom].Control:=B;


The latest version of this document can be found at lazarus-ccr.sourceforge.net.