Right Justified Label Variable Width?

GuyBooth

Active Member
Licensed User
Longtime User
Using a label with a width of -2 I know will vary the label width to accommodate the amount of text set programmatically into the lbl.text. The width reported back to the program is always -2 even when the text has been added.

I need to anchor the right hand end of a label that is Right Justified - but with the width set to -2, it still expands to the right, while I need it to expand to the left.

Is there a way to do what I want?
 

socialnetis

Active Member
Licensed User
Longtime User
I don't know if this is the best way, but should work:
As soons as the text changes, you could Measure the string width (see this) and then move the label to the left like this: Label.left = Activity.Width - StringWidth
 
Upvote 0
Top