2024-02-01 09:25 PM
How can I get the value from a textArea so I can compare it with this '-' character?
Solved! Go to Solution.
2024-02-03 12:26 AM - edited 2024-02-03 12:29 AM
Hello
So you mean you want to access single characters of textArea ?
If your textArea has wildcardBuffer, you can simply access those thru array like this:
textArea1Buffer[0]
//or
textArea1Buffer[1]
//or
textArea1Buffer[i]
//etc.
Check your viewBase.hpp to find out your buffer name if needed.
Then, if you are using just predefined text-phrases in your textArea:
// include the Text- IDs
#include <texts/TextKeysAndLanguages.hpp>
// define temp buffer, notice the max lenght
Unicode::UnicodeChar tempTxtBuffer[20];
// print your const text to buffer
Unicode::snprintf(tempTxtBuffer, 20, "%s", TypedText(YOUR_TEXT_ID).getText());
// then access you can access characters thru tempTxtBuffer
If you want to compare hole textArea, then you can use uincode::strncmp:
https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_unicode#function-strncmp
Hope this helps
Br JTP
2024-02-03 12:26 AM - edited 2024-02-03 12:29 AM
Hello
So you mean you want to access single characters of textArea ?
If your textArea has wildcardBuffer, you can simply access those thru array like this:
textArea1Buffer[0]
//or
textArea1Buffer[1]
//or
textArea1Buffer[i]
//etc.
Check your viewBase.hpp to find out your buffer name if needed.
Then, if you are using just predefined text-phrases in your textArea:
// include the Text- IDs
#include <texts/TextKeysAndLanguages.hpp>
// define temp buffer, notice the max lenght
Unicode::UnicodeChar tempTxtBuffer[20];
// print your const text to buffer
Unicode::snprintf(tempTxtBuffer, 20, "%s", TypedText(YOUR_TEXT_ID).getText());
// then access you can access characters thru tempTxtBuffer
If you want to compare hole textArea, then you can use uincode::strncmp:
https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_unicode#function-strncmp
Hope this helps
Br JTP
2024-02-03 08:40 AM
Thanks man!!, it really helps.