cancel
Showing results for 
Search instead for 
Did you mean: 

TextAreaWithWildcard displaying "?"

AMege
Associate II

When I run this code:

void Screen1View::startSession()
 
{
 
 Unicode::fromUTF8((const uint8_t*) "Hello world!!", longTxtBuffer, LONGTXT_SIZE);
 
 longTxt.invalidate();
 
}
 
 

it works as expected.

However, when I change it to:

void Screen1View::startSession()
 
{
 
 Unicode::fromUTF8((const uint8_t*) "Hello World!!", longTxtBuffer, LONGTXT_SIZE);
 
 longTxt.invalidate();
 
}

I'm seeing a ? instead of W in both simulator and target.

Is this a bug?

7 REPLIES 7

Hi Antoine,

I seems that you have pasted the same code snippet twice.

When TouchGFX displays a "?" instead of the desired character it is usually because the glyph for that unicode is not within the wildcard characters/ranges.

You can add these characters in the Designer under Texts -> Topographies

0690X000009YgujQAC.png

Regards

Martin KJELDSEN
Chief III

I modified the title of the post to "TextAreaWithWildcard displaying "?" now that we know what the issue is about. I hope you don't mind, @AMege​.

/Martin

AMege
Associate II

Hi Martin,

"I seems that you have pasted the same code snippet twice."

No, I did not, notice the capital W?

Thanks for your answer, I have now a better understanding how TouchGFX works with text and fonts and I have resolved the issue.

Next issue is how to have support for newlines in a text box...

Hi @AMege​ 

Ah, yes I see, didn't catch that the first time i read it.

The text area where you have a wildcard which contains newlines, you need to remove the check "Auto-size" in the Designer and then expand the size of the text area.

0690X000009YoxRQAS.png

Adding new lines are done as usual with \n

	Unicode::fromUTF8((const uint8_t*) "Hello World!!\nNew line", textArea2Buffer, TEXTAREA2_SIZE);
	textArea2.invalidate();

Running the application will yields "New line" written on a new line for a wildcard text (BTW, pressing F3 creates a screenshot of the simulator)

0690X000009YoxCQAS.bmp

Here is a bit more documentation on how texts works in TouchGFX:

https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts

/Anders

Removing Auto-size seemed a bit counter intuitive, but yes, that worked. Thanks!

That's because the "auto-size" calculation is done before the code is generated -> The Designer calculates the size of the text input and then sets up the high and width of the text widget.

The wildcard rendering is done at run time, and thus the needed size of the text widget is unknown.

/Anders

Yeah, it's a bit counter intuitive because for wildcards the width will be 0 if there's no initial value in the buffer and you have to resize it manually after manually updating the buffer.