cancel
Showing results for 
Search instead for 
Did you mean: 

just send a value

NicoEFI
Associate III

How to simply send a value in a text or numeric zone (textArea)?

1 ACCEPTED SOLUTION

Accepted Solutions
GaetanGodart
ST Employee

Hello @NicoEFI ,

I suggest you follow the tutorials on our website.
In the 4th chapter of the second tutorial we talk about passing value to a text area.
Find this chapter here : Tutorial 2, chapter 4 (wildcards) 

Basically, you have to add a wildcard to your text area
I usually select "used wildcard buffer", this creates an array of character of the size mentioned (minus one for the character of end of string).
Then in your code you can overwrite this buffer with :
Unicode::snprintf(param1, param2, param3, param4);
Replace param1 with the name of your text area + "buffer", ex : myTextAreaBuffer.
Replace param2 with the name of your text area in capital + "_SIZE", ex : MYTEXTAREA_SIZE.
Replace param3 with the string you want to pass, in your case an int so "%d".
Finally, replace param4 with the variable you want to print, ex : myInt.

Edit :
Don't forget to invalidate the area you want to change.
Ex : textArea.invalidate()


Hope this helps.
Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! :smiling_face_with_smiling_eyes:

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

2 REPLIES 2
GaetanGodart
ST Employee

Hello @NicoEFI ,

I suggest you follow the tutorials on our website.
In the 4th chapter of the second tutorial we talk about passing value to a text area.
Find this chapter here : Tutorial 2, chapter 4 (wildcards) 

Basically, you have to add a wildcard to your text area
I usually select "used wildcard buffer", this creates an array of character of the size mentioned (minus one for the character of end of string).
Then in your code you can overwrite this buffer with :
Unicode::snprintf(param1, param2, param3, param4);
Replace param1 with the name of your text area + "buffer", ex : myTextAreaBuffer.
Replace param2 with the name of your text area in capital + "_SIZE", ex : MYTEXTAREA_SIZE.
Replace param3 with the string you want to pass, in your case an int so "%d".
Finally, replace param4 with the variable you want to print, ex : myInt.

Edit :
Don't forget to invalidate the area you want to change.
Ex : textArea.invalidate()


Hope this helps.
Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! :smiling_face_with_smiling_eyes:

Gaetan Godart
Software engineer at ST (TouchGFX)

Thanks, i have tested this, it works 

//float valued = (float) value/10; //for decimal value
//Unicode::snprintfFloat(textArea1Buffer, TEXTAREA1_SIZE, "%.1f", valued);
//textArea1.invalidate();

value = value * 100;
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d", value);
textArea1.invalidate();