Skip to main content
ALin
Associate
August 13, 2019
Solved

How do I use the custom keyboard that's provided in TouchGFX templates.

  • August 13, 2019
  • 2 replies
  • 1040 views

Hello,

I am fairly new to the TouchGFX designer and am trying to build an application where I can copy the contents typed using the keyboard on a screen(Custom Keyboard application provided with the designer) to another TextArea . I would really appreciate any help regarding this problem.

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Just to return to this.

Keyboard has a getBuffer() method that returns the keyboard buffer.

 Unicode::UnicodeChar* getBuffer() const
 {
 return buffer;
 }

You can then use Unicode::strncpy() to copy this to whatever buffer you're using with your TextAreaWithOneWildcard

 /**
 * @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);

/Martin

2 replies

Martin KJELDSEN
Principal III
August 13, 2019

Hi,

What have you tried to so far do and what are you having issues with?

/Martin

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
August 26, 2019

Just to return to this.

Keyboard has a getBuffer() method that returns the keyboard buffer.

 Unicode::UnicodeChar* getBuffer() const
 {
 return buffer;
 }

You can then use Unicode::strncpy() to copy this to whatever buffer you're using with your TextAreaWithOneWildcard

 /**
 * @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);

/Martin