2023-12-16 08:49 AM
How to simply send a value in a text or numeric zone (textArea)?
Solved! Go to Solution.
2023-12-18 12:17 AM - edited 2023-12-19 01:56 AM
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:
2023-12-18 12:17 AM - edited 2023-12-19 01:56 AM
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:
2023-12-19 01:45 PM
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();