How do I make a specific adjustment to the text component?

0 favourites
  • 8 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hello everyone, sorry for my English. I have the following situation: I'm developing a program for typing, where the user is typing and the letters are changing color in the text component. I'm using the BBcode text plugin to be able to change the colors. As the user types, unfortunately when starting the first word of the second line, the typed letters go up to the first line, since there is a small space. This can not happen. A simple justify would do the trick, but justifying truly only works for letters, not words. Does anyone have an idea how to crash the component or force that justify? I'm going to put here two images of how it should look and how it's turning out to better exemplify.

    How are you doing:

    How it should be:

  • Did you try setting wrapping to word in the text objects properties? You have to have at least one text object on the layout in the editor for it to work and for it to safe these properties. You can delete it on start of layout.

  • Nilom I set it up, but when I'm finishing typing the line, this character break happens. I managed to solve it one way, but I wanted to try to make it easier. At the end of the last word of the line, I inserted a special character and used replace to replace this character with newline. It worked, but the inclusion of this special character has to be done manually, would there be a way for me to insert a character automatically at each line break?

  • This is strange. Do you append the text? Can you show us the code that you use?

    I'm not sure about checking for a line break.

  • Nilom

    this is the code, here I work with two arrays, they receive in each position a letter of the text contained in the variable "PALAVRA". The first array I use to compare the typed letters and the second is presented in the text box by the variable "TESTE". I did it this way because the second array is color coded if they are right or wrong. As you can see in the text, the break has to happen where I put the ¥ character. When I present the text in the text box, I have the code where I change the ¥ character to the newline, this way the forced break happens. If I don't do it that way, the problem happens, the letters of the first word of the second line are thrown to the end of the first line, occupying the vacant space, when there is no more space, the word goes back to the second line. Even adjusting the Wrapping to word, it behaves as if it were a character. The way I did it was functional, but I have to enter this code manually. If there was a way to break that line correctly or that I could automatically insert that character at the moment the line automatically wraps, I would kill the problem.

  • Okay before I try to understand your code I made a simple example on how I would implement word wrapping.

    Let me know if this could help you.

  • NilomWhen I access the link, it says that the file in it has been deleted...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Strange. I reuploaded it here.

    Edit: Updated the link again. I guess I will never ever use file.io again.

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