Skip to main content
KMod3
Associate
July 13, 2022
Question

Why is the text area not getting resized?

  • July 13, 2022
  • 2 replies
  • 875 views

I am able to display the P_soc properly but when I tries to print (P_temp_h)*0.1 if it is 4 digit( i.e 2 digit before decimal and 1 digit after decimal and decimal point) then I could display the data properly. But If it is 5 digit then the function resizeToCurrentText() is not resizing the textarea. What is wrong here?

Note: P_temp_h is an integer value and multiplying it by 0.1, I am just putting a decimal value after leftmost one digit, i.e., I am conveting it to float.

void DataScreenView::handleTickEvent()
{
	/* Board A parameter */
 b1SOC_bp.setValue(P_soc); // only integer value in %
 b1SOC_tp.setValue(P_soc); // only integer value in %
 Unicode::snprintfFloat(b1TMPval_taBuffer, B1TMPVAL_TA_SIZE, "%.1f", (P_temp_h)*0.1); //float value with precision 1
 b1TMPval_ta.resizeToCurrentText();
 b1TMPval_ta.invalidate();
}

This topic has been closed for replies.

2 replies

MM..1
Chief III
July 13, 2022

As first your Tick is executted on every frame, your mind must be flash to see it.

And realy TGFX engine cant change it so quick.

Try use counter and change only on every tens frame.

Too simpler for count is use int

"%d.%d", val/10, val%10

Osman SOYKURT
Technical Moderator
July 15, 2022

Hello KMod3,

As MM..1, I also think you should try to use counters because invalidate that value at every tick seems to be too much. And make sure your B1TMPVAL_TA_SIZE is big enough to display what you want.

/Osman

Osman SOYKURTST Software Developer | TouchGFX