Skip to main content
KNara.2
Associate III
July 18, 2023
Solved

Result with unit display

  • July 18, 2023
  • 1 reply
  • 1077 views

Hi,

I'm in the process of implementing a result screen which displays the result along with unit.

Since the digits are not the same I see a spacing issue between result and result unit.

Example : 11 cm , 22cm

and 99 cm

I cannot have a fixed x and y co ordinate for the result unit.

This is because when eleven is displayed the result shrinks and looks far away from the result unit.when its 22 the result almost touches the result unit.

Is there a way to move the result unit (wild card position) along with the result (wild card) x and y co ordinates.

So that the spacing between result and result unit remains the same for all digits?

 

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

Hi

You can use getWidth- function to get width of result and then setX or moveTo command to move unit text.

Like this:

 

unitText.moveTo(valueText.getX()+valueText.getWidth()+4,valueText.getY());

 

Br J.T

1 reply

JTP1Best answer
Graduate II
July 21, 2023

Hi

You can use getWidth- function to get width of result and then setX or moveTo command to move unit text.

Like this:

 

unitText.moveTo(valueText.getX()+valueText.getWidth()+4,valueText.getY());

 

Br J.T