Sign in Join
FPDoc Onlineexperiment

TLabel.WordWrap property

Member of TLabelpublishedIn unit StdCtrls

Allows the caption to wrap to multiple lines when it is wider than a specified length.

Declaration

pascal
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 Align is set to alTop or alBottom the width of the label's Parent controls the maximum text length. Correspondingly, when the label is rotated by +/- 90 degrees and Align is alLeft or alRight the Parent's Height determines 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.MaxWidth of 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 as Constraints.MaxWidth. It was introduced mainly to control the wordwrap positions when text is rotated (by giving the Font.Orientation a 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.