Skip to main content
Inspiring
April 18, 2019
Answered

Text wrap for dynamic text box for Animate HTML5 (Canvas) app

  • April 18, 2019
  • 1 reply
  • 1606 views

I've got a dynamic text box (txt_correct) into which I add text of varying lengths at runtime. It's set to multiline, but when the text is over a certain length, because it doesn't text wrap, the tail end of the text does not show. How do I get it to text wrap using JavaScript or from within Animate? Thanks

This topic has been closed for replies.
Correct answer Chemistry guy

I found out what the problem was. I was keeping track of the problems users were doing and presenting them in the form 1,2,3, etc. I was doing it without spaces, so what I was putting in the box was treated as one word, which, of course, doesn't text wrap. Now I'm putting in spaces, 1, 2, 3 etc., and it wraps just fine.

1 reply

Brainiac
April 18, 2019

On fixed-width dynamic textfields, text wraps and the textfield vertically expands automatically as needed. So since what you're describing is not normal behavior, we're going to need more detail.

Inspiring
April 19, 2019

I just added three dynamic text boxes and set the positions and size. Should I not set the vertical height? I add text on the fly.

root.txt_correct.text = "Correct: " + root.correctAnswers;

root.txt_incorrect.text = "Incorrect: " + root.incorrectAnswers;

root.txt_given_answers.text = "Given: " + root.givenAnswers;

Chemistry guyAuthorCorrect answer
Inspiring
April 23, 2019

I found out what the problem was. I was keeping track of the problems users were doing and presenting them in the form 1,2,3, etc. I was doing it without spaces, so what I was putting in the box was treated as one word, which, of course, doesn't text wrap. Now I'm putting in spaces, 1, 2, 3 etc., and it wraps just fine.