2019-07-02 12:29 AM
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 lines
Solved! Go to Solution.
2019-07-02 02:01 AM
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
2019-07-02 12:51 AM
Try increasing the size of your buffer - I don't think that string will fit (including termination char).
/Martin
2019-07-02 01:19 AM
I tried even with buffer size = 400 and it's the same
2019-07-02 01:26 AM
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?
2019-07-02 01:29 AM
I want to put in a big chunk of text
2019-07-02 02:01 AM
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
2019-07-02 02:08 AM
Now that works fine,
Thank you
Anton
2019-07-02 02:12 AM
Great :)