TAnchorSide class
Specifies how the side of a control is anchored to other controls.
Declaration
TAnchorSide = class(TPersistent)Inheritance
- TAnchorSide
- TPersistent
- 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
Owner | public | The control being anchored. |
Kind | public | The control side being anchored. |
Control | published | The target control of the anchor. |
Side | published | The side of the target Control, to which we anchor. |
Methods
GetOwner | protected | Gets the owner of the persistent object. |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
GetSidePosition | public | Get information about the target control, side and side position. |
CheckSidePosition | public | Checks for anchor cycles and invalid targets, and returns information about the target side. |
Assign | public | Copies properties from the specified persistent object into the current class instance. |
IsAnchoredToParent | public | True when we are anchored to our parent, at least on the ParentSide. |
FixCenterAnchoring | public | Remove 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.
