2022-06-14 01:45 AM
Greetings,
I am trying to add up texts from different scroll lists and show up in one textArea as a concatenated string as image shown below :-
I have tried converting the typed text to Unicode::UnicodeChar and then applying Unicode::strncpy but it completely replaces the text.
2022-06-14 02:52 AM
You need to show what you've actually done in order for people to be able to comment on why it might not be working.
For strncpy, you would need to be sure that you make the copy destination the NUL termination of the other string...
2022-06-14 02:58 AM
thanks for your reply I'll shortly upload the project
2022-06-14 03:10 AM
Unicode::strncpy(st1, TypedText(T_RESOURCEID1).getText(), 20);
Unicode::strncpy(st2, TypedText(T_RESOURCEID7).getText(), 20);
*st3 = *st1 + *st2;
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%s", st3);
in result of this snippet i only get the 1st column value
2022-06-14 03:12 AM
The other question would be when TouchGFX evaluates the length of the string: could it be that it evaluates it before you do the concatenation, and then only uses that length of the string - so never sees your update ... ?
2022-06-14 06:55 AM
Hello A.Qasim,
Can you show how you declared your *st3 and also your textArea1 declaration ?
/Osman
2022-06-15 01:35 AM
here i have declared the st3
here I have declared values in textArea under prefix heading
2022-06-15 03:32 AM
Hello A.Qasim,
Ok, first maybe reduce the length of your strings, 50 is too much from what I see of your UI. Secondly, all your st1, st2 and st3 length are 50, so if you do *st3 = *st1 + *st2 it can't fit. So if you want to keep 50 as the length of your st1 and st2, then try with st3[100].
And last remark, have a look at strcat() function ;)
/Osman
2022-06-15 03:38 AM
@A.Qasim - how to properly post source code:
@A.Qasim
2022-06-15 04:36 AM
I have tried the standard function strcat() but it doesn't allow implementation as it opposes the Unicode::UnicodeChar* getText() function.\and upon adding the two strings the decimal values get added up and output a random number i.e,
st1 = 80 //"P"
st2 = 59 //":"
*st3 = *st1+*st2
*st3 = 139 //null character "?"