|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 3 of 3 total|
|Creating a label at runtime and getting it to wrap|
|Tue, Aug 25 2020 5:42 AM||Permanent Link|
I am creating a number of controls at run-time to display some search results. One of the labels could have very little text in it or it could have a lot. I want the label to set it's height automatically and to wrap so it's all displayed.
The attachment shows what happens when I set AutoSize.Height = False and Height = 44. The code below produces a label (the yellow one) that shows only the first line of text with a height of 16..
Anyone know how to do this?
The label is being created with the following code:
with TLabel.Create(bp_desc) do begin
Name := 'labCompat' + IntToStr(iComp);
Caption := strCompatability;
Font.Size := 12;
Format.Wrap := True;
AutoSize.Height := True;
Layout.Position := lpTopLeft;
Layout.Stretch := lsRight;
Layout.Consumption := lcBottom;
Margins.Bottom := 0;
Margins.Left := 3;
Margins.Right := 3;
Margins.Top := 3;
Background.Fill.Color := clYellow;
Font.Color := clElevateDarkGray;
Padding.Left := 10;
Tag := iProductId;
|Tue, Aug 25 2020 9:13 AM||Permanent Link|
Paul Coshott wrote:
> Layout.Stretch := lsRight;
That stands out to me. But there are two options that conflict with each other - I can't remember which. Create a test label in the IDE and fiddle with the options until you get what you need.
|Tue, Aug 25 2020 5:46 PM||Permanent Link|
"Matthew Jones" wrote:
>> Create a test label in the IDE and fiddle with the options until you get what you need.
Thanks Matthew. I played around with it, and all I needed to do was add AutoSize.Width := False;
That did it!