cancel
Showing results for 
Search instead for 
Did you mean: 

Code generation for touchgfx::TextAreaWithOneWildcard?

vasilevskialeksandar
Associate III

I started to use TouchGFX version 4.21.1 recently. Noticed that code generation in Designer is changed compared to some old versions and this renders unusable many tutorials and documentations that can be found on net.   

My problem is that I can not display variable using TextAreaWithOneWildcard.

Basically invalidate function does nothing.

I prepared new typography with more or less default settings (-,+ as default wildcard characters,  A-Z,0-9 as Wildcard ranges).

According many tutorials on net, code generator should generate buffer for this TextAreaWithOneWildcard.

But I can see in 

MainViewBase::MainViewBase()

textArea1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_CPF7));

 and no buffer for user use.

I have added my buffer

Unicode::UnicodeChar myBuffer[20];

and in void MainView::setupScreen()

I have added the line:

textArea1.setWildcard(myBuffer);

 

I expected after execution of this code

void MainView::update_text_field(uint16_t new_val){

Unicode::snprintf(myBuffer, 20, "%02d",new_val);

textArea1.invalidate();

}

text field on the screen to be updated with the new value of the new_val.

But nothing is shown. If I put some default text in designer that text stays on the screen.

In myBuffer I can see value of the variable with unicode characters.

I will appreciate if someone can point what I am doing wrong. 

I am trying some old product to port on new custom hardware so I can not provide minimal example easily.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Yoann KLEIN
ST Employee

Hello @vasilevskialeksandar,

Did you think about checking the Use wildcard buffer check box and giving an initial value to the wildcard, like here: 

YoannKLEIN_0-1701698852087.png

Best regards,

 

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

3 REPLIES 3
Yoann KLEIN
ST Employee

Hello @vasilevskialeksandar,

Did you think about checking the Use wildcard buffer check box and giving an initial value to the wildcard, like here: 

YoannKLEIN_0-1701698852087.png

Best regards,

 

Yoann KLEIN
ST Software Developer | TouchGFX
vasilevskialeksandar
Associate III

Thanks. It works this way. I was not aware that Wildcard 1 is clik-able.

Also I needed to remove textArea1.setWildcard(myBuffer); //Note if some beginner read this thread.

Need to refresh my C++ knowledge to understand why my old way does not work since it is basically same thing.

 

 

ferro
Senior III

Hi @vasilevskialeksandar ,

I think your code does not work because you do not set TypedText for the textArea1.
TypedText must contain magic code '<>' in order for Gfx to display what you copy into Wildcard buffer.

What I do is, in the Text View Tab, I create TypedText for each alignment containing '<>' only:

ferro_0-1701768473873.png

 

Then, you use generated TEXTS::Ids ( TextKeysAndLanguages.hpp ) to initialise textArea1 :

 

void MainView::setupScreen ()
{
     textArea1.setWildcard  ( myBuffer );
     textArea1.setTypedText ( TypedText { TEXTS::T_WILD_CARD_ALIGN_LEFT } );
}

 

After that, your code should work as intended:

 

void MainView::update_text_field ( uint16_t new_val )
{
     Unicode::snprintf(myBuffer, 20, "%02d",new_val);
     textArea1.invalidate();
}

 

Ferro