Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
What happened to TextFiled? TextWrap does not work any more — Gideros Forum

What happened to TextFiled? TextWrap does not work any more

I used this class for wrapped text for years, but it does not show text correctly.
lua
lua
textwrap2.lua
5K

Comments

  • hgy29hgy29 Maintainer
    TextField has been improved a lot recently, but from the look of your textwrap class I can't see why it would misbehave now. Can you be more precise ? What does it used to do, what does it do now, which version of Gideros broke it, etc.

    Btw, TextField has built in text wrap/formatting now.
  • In 2017.3 all text is displayed on screen, but on 2018.10, some text is displayed outside of the screen.
    zip
    zip
    Textwrap.zip
    5K
  • I notice there is a layout for textfield now, it works for wrap.
  • hgy29hgy29 Maintainer
    yes indeed, it can wrap and align text all by itself.
    I had a try with your project, the issue is caused by TextField now interpreting ascii control chars such as tab (\t) and LF(\n). Your TextWrap code tries to figure out the average character size based on the given text, and it doesn't exclude those ascii control chars from the computation. In your case the string used to check character size contains a '\n', so the textfield width doesn't reflect the total string width.

    Try to change line 7 into:
    for chr in str:gfind("([ -\127\194-\244][\128-\191]*)") do
    +1 -1 (+5 / -0 )Share on Facebook
  • @hgy29
    Thanks so much.

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.