2022-03-25 06:24 AM
Hello,
I'm working on a TouchGFX GUI and I have some text areas which need to be automatically wrapped on several lines.
I'm using
Text_guideline.setTypedText(touchgfx::TypedText(guideline));
Text_guideline.setWideTextAction(WIDE_TEXT_WORDWRAP);
Text_guideline.resizeHeightToCurrentText();
then the text is wrapped on several lines (as expected), but the 2nd line is truncated : its width is equal to that of the first line. I included images with the text "Buona ventilazione" on 2 lines, note that I fully see the second line only when I pad the first one to be wider.
Here is my question : How can I fully display each line even if they are wider than the first line, for a line-wrapped text ?
Thank you in advance for any help !
Solved! Go to Solution.
2022-03-28 05:36 AM
I found the solution ! The problem I had was on a project created under TouchGFX Designer 4.17.0, I migrated to version 4.19.0 and recreated the text areas that didn't display well (I deleted them & remade them), and now they work great !
2022-03-25 08:27 AM
Try use other method, this do what you ask
Text_guideline.resizeHeightToCurrentText();
2022-03-27 11:46 PM
Hi ! Thanks for your answer, but I don't understand, I'm already using this method (see the code snippet in my question), should I use it differently ?
I forgot to mentio that I disabled the option "Auto-size". Moreover, when I print the width of my text are at run time, I see that it is as wide as the whole box, thus wider than the first line...
2022-03-28 12:10 AM
2022-03-28 12:29 AM
Alright, I tried to replace the 3rd line of
Text_guideline.setTypedText(touchgfx::TypedText(guideline));
Text_guideline.setWideTextAction(WIDE_TEXT_WORDWRAP);
Text_guideline.resizeHeightToCurrentText();
by each of the functions you mentionned, but the display never changed, it remains as showed in the images in the question. But I agree that it should work, I don't get what I am missing here.
2022-03-28 02:05 AM
2022-03-28 02:07 AM
Oops, sorry I didn't show it but I am actually using it :
Text_guideline.setTypedText(touchgfx::TypedText(guideline));
Text_guideline.setWideTextAction(WIDE_TEXT_WORDWRAP);
Text_guideline.resizeToCurrentTextWithAlignment();
Text_guideline.invalidate();
2022-03-28 05:36 AM
I found the solution ! The problem I had was on a project created under TouchGFX Designer 4.17.0, I migrated to version 4.19.0 and recreated the text areas that didn't display well (I deleted them & remade them), and now they work great !
2022-05-18 03:18 AM
What was the change in the code that fixed this?
2022-05-18 04:53 AM
I think there was none, maybe it was an issue with Designer 4.17.0...