TLabel.WordWrap property
Allows the caption to wrap to multiple lines when it is wider than a specified length.
Declaration
property WordWrap:;Description
WordWrap is a
Boolean property which indicates that the
caption in the control can be wrapped to multiple lines when its length
exceeds a maximum value depending on various restrictions:
- When
Alignis set toalToporalBottomthe width of the label'sParentcontrols the maximum text length. Correspondingly, when the label is rotated by +/- 90 degrees andAlignisalLeftoralRighttheParent'sHeightdetermines the length. - Wordwrap positions can also be defined by anchoring of the label to other controls so that the label's size is restricted.
- When the
Constraints.MaxWidthof the label is set to a positive value it immediately defines the maximum text length for wrapping. - The
WordWrapLength, new in Lazarus v5.0, has the same effect on wrapping asConstraints.MaxWidth. It was introduced mainly to control the wordwrap positions when text is rotated (by giving theFont.Orientationa non-zero value in 1/10 degrees).
The default value for the WordWrap property is False.
When a new value is assigned to the property, the Invalidate and
UpdateSize methods are called to auto-size and repaint the control.
When WordWrap is False, the text is truncated at the right boundary when it is too long for the control Width. The same happens even when WordWrap is True, but no restriction has been set up for the text length.
When both WordWrap and AutoSize are True, the
word-wrap positions are calculated first, and then the right and bottom sides
of the label are adjusted so that the text is enclosed tightly.
This description is the one of StdCtrls.TCustomLabel.WordWrap.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
