cancel
Showing results for 
Search instead for 
Did you mean: 

Number display issue

JPan.4
Associate II

ToughGFX Designer: 4.20.0

STM32Cube IDE: 1.11.0

Hello there,

i'm using touchgfx to show received data using

Unicode::snprintf(FenceNumBuffer, FENCENUM_SIZE, "%d", g_displayCtlBlk.fenceConfigS1);

Recently I found if I place

FenceNum.resizeToCurrentText();

directly after

Unicode::snprintf(FenceNumBuffer, FENCENUM_SIZE, "%d", g_displayCtlBlk.fenceConfigS1);

the character in the MSB of FenceNumBuffer will still remain in the buffer (on the display the current number will be mixed with the old long number).

However, if this resize function is placed after invalidate function (or without resize function), although in the FenceNumBuffer there still exits old value, it seems the terminal \0 did work, it prevents showing the old value.

Is there anyone, who can explain this phenomena

?

Best regards

J.Pan

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief II

I mean explain is clear from name. resizeToCurrentText do what is writed and ignore old area

Clean steps

    textArea1.setWildcard(textArea1Buffer);
    textArea1.invalidate();
    textArea1.resizeToCurrentTextWithAlignment();
    textArea1.invalidate();

View solution in original post

4 REPLIES 4
MM..1
Chief II

I mean explain is clear from name. resizeToCurrentText do what is writed and ignore old area

Clean steps

    textArea1.setWildcard(textArea1Buffer);
    textArea1.invalidate();
    textArea1.resizeToCurrentTextWithAlignment();
    textArea1.invalidate();

Hello @MM..1​ thank you for your explanation.

I am not familiar with the touchgfx library. But as far as I can see from the description of the resizeToCurrentText function, the functionality of this function is only to reset the dimension of the textArea.

How can it have an impact on the wildcard? I mean, my textAreaBuffer is null-terminated. Should it not only show the character before null-termination?

Best regards,

J.Pan

Osman SOYKURT
ST Employee

Hello JPan.4,

Can you show us some examples of code and the results you got on simulator, and also what you expect. Some screenshots to visualize you issue would be helpful.

From what I know, resizeToCurrentText() shouldn't have an impact to the wildcard buffer itself.

/Osman

Osman SOYKURT
ST Software Developer | TouchGFX

Yes first line in my code maybe isnt required, but

Unicode::snprintf(

have no connection with object, and object have no info about change buffer. Then clean before invalidate is set marker what is invalidated. Here wildcard.

After this can be resized... @Osman SOYKURT​ try create text with number 100 and then in code show 7