how to detect wordWrapping event in native.newTextBox?

Hi,

Does anybody know if there’s a way to detect a word wrapping event in native.newTextBox?

I’d like to expand the text box size and decrease the font size on the go as the user is typing a longer piece of text.

So I’d like to start with a small textbox with a big font size, and then expand the text box and make the font smaller.

Is there an easy way to detect word wrapping, or I have to assume how many words of particular font size fit in one line and write a method on that basis?

Hi @whammy,

Yes, I think you’ll have to predict/test the number of characters and write a resizing method based on that. Remember that the default font size may vary considerably between iOS and Android, but you should be able to equalize it by setting one or the other up/down in size as needed.

http://docs.coronalabs.com/api/type/TextBox/size.html

Brent

Hi @Brent

OK, so there’s no easy way :slight_smile: Thanks for the answer.

Hi @whammy,

Yes, I think you’ll have to predict/test the number of characters and write a resizing method based on that. Remember that the default font size may vary considerably between iOS and Android, but you should be able to equalize it by setting one or the other up/down in size as needed.

http://docs.coronalabs.com/api/type/TextBox/size.html

Brent

Hi @Brent

OK, so there’s no easy way :slight_smile: Thanks for the answer.