cancel
Showing results for 
Search instead for 
Did you mean: 

Text invalidate problem

EEuge
Senior

Hello!

I put textArea to Screen.

Here is code from Screen1ViewBase.cpp

tempText.setXY(489, 143);
    tempText.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0));
    tempText.setLinespacing(0);
    Unicode::snprintf(tempTextBuffer, TEMPTEXT_SIZE, "%s", touchgfx::TypedText(T_TEXTID2).getText());
    tempText.setWildcard(tempTextBuffer);
    tempText.resizeToCurrentText();
    tempText.setTypedText(touchgfx::TypedText(T_SINGLEUSEID9));
 
    add(tempText);

in screen1Veiw.cpp I try to change text

void Screen1View::Show_HotEnd1_Temperature(uint32_t temp)
{
    
    Unicode::snprintf(tempTextBuffer, 3, "%d", temp);
    tempText.invalidate();
}

Be sure, function Show_HotEnd1_Temperature is called and "temp"is not null.

But text not changes. Only anothe videobuffer activates (don't ask me how I know it)

What's wrong?

May be problem with wildcards?

I load example from TOuchGFXDesigner, and look to the textArea's config

0690X00000DXIILQA5.png

But when I try to config my own textArea, I can't see "wildcard" button

0690X00000DXIIQQA5.png

what's wrong?

1 REPLY 1
Martin KJELDSEN
Chief III

Does tempText have a width? What you can do after updating the buffer is call

textArea.resizeToCurrentText();

Or, you can start with a fixed width. My guess is that the text area is being updated, but the width is 0. When you add a textarea with wildcard from the designer, resize to current text is default, and if there's no default text to start with, then that width is 0 - Never to be updated again unless you do it manually.

/Martin