cancel
Showing results for 
Search instead for 
Did you mean: 

C++ Strings Interpreted As Fallback Characters

CPaye.1
Associate III

I am using TGX v4.16.0. All of the work I describe with is with the TGX simulator in MSVS.

I am building native C++ strings from C character arrays. I am then taking these strings and using them to update a single wildcard text area. Most of the text is displayed correctly but some of the characters are interpreted as the fallback character (?). I am using a standard English language font. The characters that trigger the fallback character are in the range of A - Z. I have verified that the C++ string is being built correctly and that the wildcard buffer is big enough to hold the string.

Here is a part of the code and the result.

Initialization of the text area:

m_mfgInfo.setWildcard(m_mfgInfoBuf);
m_mfgInfo.setTypedText(touchgfx::TypedText(T_MFG_INFO));
m_mfgInfo.setXY(150, 150);
m_mfgInfo.resizeToCurrentText();
add(m_mfgInfo);

Update of the text area:

void MyView::SetData(MyData_t& data)
{
 
    Unicode::strncpy(m_mfgInfoBuf, data.mfgInfo->c_str(),
        static_cast<uint16_t>(data.mfgInfo.length()));
 
    m_mfgInfo.resizeToCurrentText();
    m_mfgInfo.invalidate();
 
}

Result:

0693W00000Bbp5KQAR.png 

I have verified that if I replace the characters that trigger the wildcard with "P", that the string is displayed without the wildcards.

I am at a loss as to how to explain this. Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief III

In TouchGFX designer font window you need define char ranges for desired font used in textarea. Without this def your code know only characters used on strings entered as default in designer, all other is replaced by ?

View solution in original post

2 REPLIES 2
MM..1
Chief III

In TouchGFX designer font window you need define char ranges for desired font used in textarea. Without this def your code know only characters used on strings entered as default in designer, all other is replaced by ?

MM - Good call! That was it. I was not using Designer for this view and I completely forgot about having to define the wildcard ranges and characters. I had a small range defined so that is probably why some characters were interpreted correctly.

Thanks for the help.