Skip to main content
July 2, 2019
Solved

Problem with text scrolling

  • July 2, 2019
  • 7 replies
  • 1842 views

Hello

I want to scroll text by hardware buttons, I call doScroll function and it works fine,

but only if I put text in the text area using TouchGFX Designer,

if I want to change the text, for example 14 lines

Unicode::snprintf(textArea1Buffer,100,"test1\ntest2\ntest3\ntest4\ntest5\ntest6\ntest7\ntest8\ntest9\ntest10\ntestasd11\ntest12\ntest13\ntest14\n");
textArea1.invalidate();
scrollableContainer1.invalidate();

I can scroll 10 of them, but instead of line 11 I get "???" and no 12,13,14 lines0690X000008j3VXQAY.jpg

This topic has been closed for replies.
Best answer by
The format string is internally copied from at char* to a UnicodeChar*. This buffer
 * has a limit of 63 characters, so if the format is longer than 63 characters, the
 * caller must do this copying to prevent an assert from triggering:
 * \code{.cpp}
 * touchgfx::Unicode::UnicodeChar tmpfmt[200];
 * touchgfx::Unicode::strncpy(tmpfmt, "Very, very, very, very, very, very, very, very, very long format %i", 200);
 * touchgfx::Unicode::snprintf(dst, dstSize, tmpfmt, ...);
 * \endcode

This is what I found in snprintf description

7 replies

Martin KJELDSEN
Principal III
July 2, 2019

Try increasing the size of your buffer - I don't think that string will fit (including termination char).

/Martin

July 2, 2019

I tried even with buffer size = 400 and it's the same

Martin KJELDSEN
Principal III
July 2, 2019

Something different: Just to be sure you're doing what you intend to do. Are you simply trying to put in a big chunk of text to scroll in? Or should each line be able to do something?

July 2, 2019

I want to put in a big chunk of text