How do I keep text vertically in place in text field?

0 favourites
  • 4 posts
From the Asset Store
A very simple to set up ZElevation based depth of field system for your game. Fully commented.
  • I have a text object that display the email address of my users when they type it on a OnScreen keyboard. I use this technique because the Input Text box get resize very small thanks to the Android' own keyboard. (export HTML5)

    So, when the user touch the sprites buttons, I simply update a variable (e.g. myText=myText&"A") then set text to my Email Box to this variable. Everything is fine until there is too many characters.

    The Textbox can contain about 30 characters max (I cannot change this for design purpose) and must have fixed width.

    When I get to type a very long email (which contain no space) the text completely disappear. If I enlarge the height of the text box I can see what happen, it does really shift like half a line down

    Wrapping word or character don't change anything. What I look for is the behavior that text does when you select "SINGLE LINE" in Flash. Meaning the text on the left is just push toward the left as you type so you can still see what you are typing.

    Is there a way to fix that? Please ask me if you need more info.

  • You can simply trim the text in Email Box to 30 characters. It will look like the text is shifting to the left as the user types over 30 characters.

    EmailBox:  Set Text to Right(myText,  30)[/code:177f4l0t]
    Update: I tried it and it appears that the Right(string,30) function works incorrectly when the string is shorter than 30 chars, so you can modify it to something like this:
    [code:177f4l0t]EmailBox:  Set Text to Right(myText,  min(len(myText), 30))
    EmailBox:  Set Text to len(myText)>30 ? Right(myText, 30) : myText
  • Maybe try the anchor behavior?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thx a lot DOP2000, it is really appreciated!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)