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

TControlChildSizing.ShrinkHorizontal

Various ways to fit controls into the available Width.

Declaration

Source position: controls.pp line 1981

published property TControlChildSizing.ShrinkHorizontal : TChildControlResizeStyle
  read FShrinkHorizontal
  write SetShrinkHorizontal
  default crsAnchorAligning;

Description

ShrinkHorizontal is a TChildControlResizeStyle property which indicates if and how child controls are resized and aligned horizontally on the parent control. It can contain one of the values from the TChildControlResizeStyle enumeration.

The default value for the property is crsAnchorAligning, and causes the width of child control to be determined using the Anchor and Align properties (like Delphi). For example if Anchors property of the control is [akLeft], it means fixed distance between left border of parent's client area. [akRight] means fixed distance between right border for the control and the right border for the client area on the Parent.

When the parent is resized, the child is moved to keep the defined distances. [akLeft,akRight] means fixed distance to left border and fixed distance to right border. When the parent is resized, the controls width is changed (resized) to keep the left and right distance. Same for akTop, akBottom.

When Align is set to alLeft, the means the control Left and Top are adjusted to fill the available space with the Height at its maximum value. The Width is retained if akRight is not set. If akRight is set in the Anchors property, then the right distance is kept and the control width is resized. If there are several child controls with Align set to alLeft, they will not overlap and be placed side by side. Same for alRight, alTop, alBottom. (Always expand 3 sides).

When Align is alClient. The control will fill the available space in the client area on the parent control. Setting Align in two child controls to alClient can be used if there are maximum value (for width and/or height) in the Constraints property.

Order: First all alTop children are resized, then alBottom, then alLeft, then alRight and finally alClient.

Changing the value for the ShrinkHorizontal property causes the Change method to be called. This causes child controls to recalculate their preferred size and to be realigned on the Control. The OnChange event handler is also signalled (when assigned).

See also

TControlChildSizing.Change

  

Notifies the Control of the child sizing changes and signals the OnChange event handler.

TWinControl.DoChildSizingChange

  

Called after a change in ChildSizing information to trigger further processing.

TWinControl.Realign

  

Adjusts the size and placement for the control and all of its children.

TControl.Align

  

Specifies the placement of the control on its Parent control.

TControl.Anchors

  

The set of anchor definitions for this control.

TControl.BorderSpacing

  

Determines the inner and outer border spacing for this control.