I create a TLabel
and add text to it dynamically, and that works just fine. But I need to know if the label word-wrapped the text because it was too large for the label's width, or if there was no need to it to wrap because the text was shorter than the label's width.
I don't mean to know whether the label's WordWrap
property is set to true or false, I want to know if it wrapped the text or it didn’t.
The TLabel
has the AutoSize
and WordWrap
properties set to true, in case that matters.
You can check the label's height to find out if it is a one liner or not.
if Label1.Height = Label1.Canvas.TextHeight('.') then
// no word wrapped
When WordWrap is True, the width of the label is fixed. If AutoSize is also True, changes to the text cause the label to change in height.