Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • The easiest solution is to use separate labels. Commented Nov 29, 2016 at 18:29
  • I'm creating this in run time, so, if I use 2 labels, I need to know where the text of the first ends. How can I know this? Commented Nov 29, 2016 at 18:31
  • 3
    label1.Canvas.TextWidth(label1.Caption) Commented Nov 29, 2016 at 18:35
  • 2
    Or, by default Labels have auto-size enabled. Commented Nov 29, 2016 at 18:41
  • 2
    You could set Label2.Position.X := Label1.Position.X + Label1.Width after assigning Label1.Caption. A better option would be to place the two Labels on a TRelativePanel and then you can set Label2.RightOf = Label1 so it stays to the right of Label1 regardless of any changes to Label1's width. See Using the Relative Panel. Commented Nov 29, 2016 at 21:23