RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Controls.AnchorAlign Constant

Defines the default sets of anchor types for all component alignment values.

Pascal
AnchorAlign: array[TAlign] of TAnchors = ( [akLeft, akTop], [akLeft, akTop, akRight], [akLeft, akRight, akBottom], [akLeft, akTop, akBottom], [akRight, akTop, akBottom], [akLeft, akTop, akRight, akBottom], [akLeft, akTop] );
C++
array[TAlign] of TAnchors AnchorAlign = ( [akLeft, akTop], [akLeft, akTop, akRight], [akLeft, akRight, akBottom], [akLeft, akTop, akBottom], [akRight, akTop, akBottom], [akLeft, akTop, akRight, akBottom], [akLeft, akTop] );

Controls

Component alignment and anchoring are closely related. Setting an anchor to true means that a side of a component will remain the designed distance from the edge of the container at run time. Alignment simply forces this distance to be zero at design time (if we disregard margin and padding values).  

For example, a component with Align set to alLeft in the Object Inspector will hug the left side of its container regardless of any effort to reposition it. You can, however, adjust its width since the right side position is not forced to align with the right side of the container - the akRight anchor value is false.  

AnchorAlign defines the default set of TAnchorKind anchor values for each possible TAlign value :

TAlign value 
TAnchorKind values set 
Meaning 
alNone  
akLeft, akTop  
No design time forced alignment is performed.  
alTop  
akLeft, akTop, akRight  
Component is forced to align with top of the container - along with the left and right.  
alBottom  
akLeft, akRight, akBottom  
Component is forced to align with bottom of the container - along with the left and right.  
alLeft  
akLeft, akTop, akBottom  
Component is forced to align with left of the container - along with the top and bottom.  
alRight  
akRight, akTop, akBottom  
Component is forced to align with right of the container - along with the top and bottom.  
alClient  
akLeft, akTop, akRight, akBottom  
Component is forced to align with all sides of the container. If another control already occupies part of the container, the control resizes to fit within the remaining client area.  
alCustom  
akLeft, akTop  
The control's positioning is determined by calls to its parent's CustomAlignInsertBefore and CustomAlignPosition methods.  

Note: In the above, the container is the parent component inside which the current component is being positioned. If that parent already has aligned component(s), the current component respects them. For example, a 2nd alLeft aligned component will align to the immediate right of the first component.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!