cancel
Showing results for 
Search instead for 
Did you mean: 

TextArea

ferdlf
Associate III

How can I get the value from a textArea so I can compare it with this '-' character?

1 ACCEPTED SOLUTION

Accepted Solutions
JTP1
Lead

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

View solution in original post

2 REPLIES 2
JTP1
Lead

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

ferdlf
Associate III

Thanks man!!, it really helps.