2022-12-22 07:21 AM
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
Solved! Go to Solution.
2022-12-22 07:45 AM
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();
2022-12-22 07:45 AM
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();
2022-12-23 08:03 AM
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
2023-01-02 06:28 AM
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
2023-01-05 09:04 AM
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