cancel
Showing results for 
Search instead for 
Did you mean: 

touch gfx TEXT type

er3481
Associate III

Hi,

There is an example in touch gfx designer named "TouchGFX Demo 2". There is carousel for swiping the icons, while swiping icons, there is a text swiped below icons in MainMenuCarousel page. This text is constant and is defined as TEXT type, so we can not use any char array string instead of this text. How can i copy and use any char array to carousel icons text?

1 REPLY 1
Martin KJELDSEN
Chief III

You can use the functions in the Unicode class to copy either a char- or UnicodeChar-array into a UnicodeChar-array.

    /**
     * @fn static uint16_t Unicode::strncpy(UnicodeChar* RESTRICT dst, const UnicodeChar* RESTRICT src, uint16_t maxchars);
     *
     * @brief Copy a string to a destination buffer, UnicodeChar to UnicodeChar version.
     *
     *        Copy a string to a destination buffer, UnicodeChar to UnicodeChar version. Stops if it
     *        encounters a zero-termination, in which case the zero-termination is included in
     *        the destination string. Otherwise copies maxchars.
     *
     * @param [out] dst The destination buffer. Must have a size of at least maxchars.
     * @param [in] src  The source string (UnicodeChars)
     * @param maxchars  Maximum number of characters to copy.
     *
     * @return The number of characters copied (excluding zero-termination if encountered)
     *
     * @warning If there is no null-termination among the first n UnicodeChars of src,
     *          the string placed in destination will NOT be zero-terminated!
     */
    static uint16_t strncpy(UnicodeChar* RESTRICT dst, const UnicodeChar* RESTRICT src, uint16_t maxchars);
 
    /**
     * @fn static uint16_t Unicode::strncpy(UnicodeChar* RESTRICT dst, const char* RESTRICT src, uint16_t maxchars);
     *
     * @brief Copy a string to a destination buffer, char to UnicodeChar version.
     *
     *        Copy a string to a destination buffer, char to UnicodeChar version. Stops if it encounters a
     *        zero-termination, in which case the zero-termination is included in the
     *        destination string. Otherwise copies maxchars.
     *
     * @param [out] dst The destination buffer. Must have a size of at least maxchars.
     * @param [in] src  The source string as an array of chars.
     * @param maxchars  Maximum number of characters to copy.
     *
     * @return The number of characters copied (excluding zero-termination if encountered)
     *
     * @warning If there is no null-termination among the first n bytes of src, the
     *          string placed in destination will NOT be zero-terminated!
     */
    static uint16_t strncpy(UnicodeChar* RESTRICT dst, const char* RESTRICT src, uint16_t maxchars);