Wrapping the text in a text box automatically.

  • I don't know whether i'm blind, stupid, or both, but i can't find a way to make the text in a text box automatically wrap.

    let me explain...

    i'm making a level editor, and when you save a level, it gives off a huge amount of text, which goes in one straight line, instead of filling the space i provided it with. Is their either a built in way to do this, or is there a plugin?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use Text instead of Textbox, and set Wrapping to Word.

  • Change the 'Type' to 'Textarea' under the TextBox properties.

  • Change the 'Type' to 'Textarea' under the TextBox properties.

    oh man, thanks! this is just what i needed!

  • I had a similar problem and this was one of the rare posts i found. Even though my problem was not related to text boxes but the normal text emelement, i still post my answer here in case anyone else stumbles over this:

    My text box, using an imported font, did not show any text that was wrapped (on mobile devices only); so it only showed the first line and cut of words even leaving splinters of letters behind. Testing on PC the text rendered fine.

    Events wise I set my text first, referring to this manual excerpt: "TextWidth

    TextHeight

    Return the size of the actual text content within the text object's rectangle. Note the Text object must be drawn before these have the correct values. If you set the text then immediately access these expressions, they won't yet have the correct value. Adding a 'Wait 0.1 seconds' action will usually solve this." scirra.com/manual/116/text

    Then I set width and height, to position other elements responsive to its position and size.

    THE ANSWER TO THE TEXT BEING CUT OFF:

    It seamed to have something to do with "custom font" + "Enabled BBCode". As soon as I disabled it in the properties of the text object, everything works fine on all devices.

    I hope this might help somebody in the future :)

    Best,

    Chris

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