2019-10-12 02:18 AM
Hello everyone,
I am trying to build an application where I can copy whatever is displayed on the CusotmKeyboard's text area to my own custom text area in my MainView. The keyboard I am referring to is the one provided with the examples . I would really appreciate any help regarding this problem.
@Martin KJELDSEN
Solved! Go to Solution.
2019-10-14 05:08 AM
Hi @AKetc,
You can copy from one TextArea to another by using the following method from the Unicode class.
/**
* @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);
You should be able to use this to get the UnicodeChar array from your Keyboard Class and copy it into a TextArea in your view.
/Martin
2019-10-14 05:08 AM
Hi @AKetc,
You can copy from one TextArea to another by using the following method from the Unicode class.
/**
* @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);
You should be able to use this to get the UnicodeChar array from your Keyboard Class and copy it into a TextArea in your view.
/Martin
2019-10-15 12:08 AM
Thanks for the help. Really appreciate it.
2019-10-15 12:53 AM
Anytime!
/Martin