cancel
Showing results for 
Search instead for 
Did you mean: 

Anchor / align wildcard texts right instead of left

Tuoman
Senior II

Hi,

I want to use wildcard texts, which align text to right instead of left.

I have empty text items (nothing but <value>), which have text area width set to full width of the screen. I need the text inside the text area to be "anchored" to right side, so that the added text will "grow" left, instead of right.

Align feature does not seem to do anything.

So far I cannot figure out anything else than manually call  textItemRight.moveTo(XPOS - textItemRight.getWidth(), textItemRight.getY());

to align texts to right. This is cumbersome to do manually for many texts.

1 ACCEPTED SOLUTION

Accepted Solutions
Tuoman
Senior II

Ah, found the answer here:

https://community.st.com/s/question/0D50X0000BrB1nTSQS/alignmentjustification-of-numeric-text-in-wildcard

It seems I should not call resizeToCurrentText()... Now the text aligns to the right!

View solution in original post

6 REPLIES 6
Tuoman
Senior II

Ah, found the answer here:

https://community.st.com/s/question/0D50X0000BrB1nTSQS/alignmentjustification-of-numeric-text-in-wildcard

It seems I should not call resizeToCurrentText()... Now the text aligns to the right!

Martin KJELDSEN
Chief III

Yea, the use of resizeToCurrentText() can be a bit tricky when working with Wildcards.

Additional question:

Why resources do not have alignment option?

Now I need to create 20+ single use texts to be able to use the alignment for the texts, instead of using one resource which has the <value> tag.

There is an alignment option for text resources. Not sure i follow you.

Ah yes, you are right, found it! It is of course set in the resources tab, instead of the Text Area settings (where single use text alignment is set)

Great, thank you!

No problem 🙂