2021-03-15 06:25 AM
Hello
I have a TextArea Wildcard in my display that shows "ON" or "OFF" when the screen entered and has a FlexButton in front of it. when FlexButton clicked, I want to change the current State. To do that (I believe) have to get the wildcard value and compare it with the constant "ON", then change the wildcard value in the IF statement. So what is a straight way to do that?
Solved! Go to Solution.
2021-03-15 06:45 PM
Hello MiladChalipa,
When it comes to comparing states, using a Boolean is more common and easier to code. Simply create a Boolean variable that switches from true to false accordingly and perform your action (here changing the textArea content) according to the current state/ value of the Boolean.
But for your information here is one way to compare the content of a TextArea :
Unicode::UnicodeChar tmp[2] = {'O','N'};
if(Unicode::strncmp(tmp, textArea1.getWildcard(), 2) == 0)
{
touchgfx_printf("equal\n");
}
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre
2021-03-15 06:45 PM
Hello MiladChalipa,
When it comes to comparing states, using a Boolean is more common and easier to code. Simply create a Boolean variable that switches from true to false accordingly and perform your action (here changing the textArea content) according to the current state/ value of the Boolean.
But for your information here is one way to compare the content of a TextArea :
Unicode::UnicodeChar tmp[2] = {'O','N'};
if(Unicode::strncmp(tmp, textArea1.getWildcard(), 2) == 0)
{
touchgfx_printf("equal\n");
}
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre