Sign in Join
FPDoc Onlineexperiment

TAnchorSide class

In unit Controls

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

Declaration

pascal
TAnchorSide = class(TPersistent)

Inheritance

  1. TAnchorSide
  2. TPersistent
  3. TObject

Description

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. For example:

+-----+  +-----+
|  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.

Another example:

+-------+
|       | +---+
|   B   | | A |
|       | +---+
+-------+

Centering A relative to B:

A.AnchorSide[akTop].Side:=asrCenter;
  A.AnchorSide[akTop].Control:=B;

Or use this equivalent:

A.AnchorSide[akBottom].Side:=asrCenter;
  A.AnchorSide[akBottom].Control:=B;

Properties

OwnerpublicThe control being anchored.
KindpublicThe control side being anchored.
ControlpublishedThe target control of the anchor.
SidepublishedThe side of the target Control, to which we anchor.

Methods

GetOwnerprotectedGets the owner of the persistent object.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
GetSidePositionpublicGet information about the target control, side and side position.
CheckSidePositionpublicChecks for anchor cycles and invalid targets, and returns information about the target side.
AssignpublicCopies properties from the specified persistent object into the current class instance.
IsAnchoredToParentpublicTrue when we are anchored to our parent, at least on the ParentSide.
FixCenterAnchoringpublicRemove conflicting anchors.

Inherited

From TPersistent (6)

AssignTo DefineProperties FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.