cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the text area not getting resized?

KMod3
Associate II

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();
}

2 REPLIES 2
MM..1
Chief III

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
ST Employee

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 SOYKURT
ST Software Developer | TouchGFX