cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with text scrolling

qqAnton
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
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

View solution in original post

7 REPLIES 7
Martin KJELDSEN
Chief III

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

/Martin

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

Martin KJELDSEN
Chief III

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?

I want to put in a big chunk of text

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

Now that works fine,

Thank you

Anton

Great :)