Skip to main content
Tuoman
Senior II
June 29, 2020
Solved

Anchor / align wildcard texts right instead of left

  • June 29, 2020
  • 6 replies
  • 1298 views

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.

This topic has been closed for replies.
Best answer by Tuoman

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!

6 replies

Tuoman
TuomanAuthorBest answer
Senior II
June 29, 2020

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
Principal III
June 29, 2020

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

Tuoman
TuomanAuthor
Senior II
June 29, 2020

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.

Martin KJELDSEN
Principal III
June 29, 2020

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