Textobject should grow to the right

Hi Coronas!

I coded a numeric key panel and a text object. Using the key pad the numbers appears within the text field like a calculator everybody knows. Each new number should appear after another one but the text grows to the left. I experimented with Centerpoints but without success. Someone got an idea?

TIA!

hey there,
you need to re position the text after each input.

so each time you send the user input to the display text do the following as well:
[lua]
yourTextObj:setReferencePoint(display.TopLeftReferencePoint)

yourTextObj.x = 123 --whatever position your left aligned text should stay
[/lua]

Hey! It works well! Sometimes it seems that there is a small shift but it works. Thanks a lot!!

hmm, a small shift shouldnt happen.
does it happen at the very beginning? if so you need to put those two lines under the part where you initialise the textobject the first time as well.

I’m glad i could help.
have a nice day,
Michael

This is interesting. I tried it with each number (i only use numbers). The first number is ok. At second number both numbers shift to the left (approx. 1-2 pixels). At 6th number all numbers shift to the right and 7th number all back to the left. And this seems to be systematically…6./7…12./13…and so on. Mysterious. :o

hey there,
you need to re position the text after each input.

so each time you send the user input to the display text do the following as well:
[lua]
yourTextObj:setReferencePoint(display.TopLeftReferencePoint)

yourTextObj.x = 123 --whatever position your left aligned text should stay
[/lua]

Hey! It works well! Sometimes it seems that there is a small shift but it works. Thanks a lot!!

hmm, a small shift shouldnt happen.
does it happen at the very beginning? if so you need to put those two lines under the part where you initialise the textobject the first time as well.

I’m glad i could help.
have a nice day,
Michael

This is interesting. I tried it with each number (i only use numbers). The first number is ok. At second number both numbers shift to the left (approx. 1-2 pixels). At 6th number all numbers shift to the right and 7th number all back to the left. And this seems to be systematically…6./7…12./13…and so on. Mysterious. :o