TouchGFX - Truncated line when using word wrapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-25 6: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.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 5: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-25 8:27 AM
Try use other method, this do what you ask
Text_guideline.resizeHeightToCurrentText();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 12:10 AM
Sets the height of the TextArea to match the height of the current associated text for the current selected language.
void resizeHeightToCurrentTextWithRotation()
Sets the height of the TextArea to match the height of the current associated text for the current selected language.
void resizeToCurrentText()
Sets the dimensions of the TextArea to match the width and height of the current associated text for the current selected language.
void resizeToCurrentTextWithAlignment()
Sets the dimensions of the TextArea to match the width and height of the current associated text for the current selected language, and for centered and right aligned text, the position of the TextArea widget is also updated to keep the text in the same position on the display.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 2:05 AM
Text_guideline.invalidate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 2: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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 5: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-18 3:18 AM
What was the change in the code that fixed this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-18 4:53 AM
I think there was none, maybe it was an issue with Designer 4.17.0...
