cancel
Showing results for 
Search instead for 
Did you mean: 

printing updated strings in a model

prathima
Associate II

hello people..

actually i want to display a string..

i did in this way

char buff[10]="hello";

Unicode::snprintf(buffer,10,"%s",buff);

but am not getting anything.....

in the prinf the buffer is i had the textarea from touchgfx that buffer am taking here...

can you sortout my issue

thank you...

16 REPLIES 16
jimmii
Senior II
JHarding
Senior

I just ran into this issue the other day.

If you want to take a character array like you have and stuff it into a TouchGFX text buffer you need to do a couple things.

  • Use Unicode::strncpy to convert your char array to Unicode.
  • Make sure the font associated with the TextArea has wildcards for the characters in your char array
  • Make sure that the text field is being resized to fit all of the text you are adding by calling resizeToCurrentText() on the TextArea object.
  • Lastly, make sure you are calling the invalidate() function on the TextArea object.

Also, this page is your best friend. It contains a wealth of information on this topic: https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts?mobile_site=true

Thank you jimmi.....

but i have seen this article ...but my way of doing it is ...i had a text with blank and wildcard of size 10 in touchgfx.

In the model i have defined int i2c=100;

and am printing it in view....using Unicode::snprinf(TexareaBuffer,10,"%d",i2c);

this is working fine, but in the place of int variable i2c=100, i want to declare a buffer like this.............................. char buff[10]="hello";

this i want to display in view..

i did like this

Unicode::snprinf(TexareaBuffer,10"%s",buff);

but it is displaying question mark(?)

if i do directly Unicode::snprinf(TexareaBuffer,10"%s","hello");

the same issue...

so that is why i asked about how to print a string only string not integer..

and in touchgfx i written Wildcard char is 0-F and wildcard range 0-9..still same issue..

please help me to fix this issue....

prathima
Associate II

it is working now,,,,,, but when i want to leave initially my wildcard is empty in that case it is not working...

i want it works in this case also...

i have filled my wild card with abcdefghij.

if i want to print "zxzx" which i haven't written in wild card then it's giving quesion marks again...i have to make it works in this case also... why because we can not write all the chacters in wild card .....please help me...

it is working now,,,,,, but when i want to leave initially my wildcard is empty in that case it is not working...

i want it works in this case also...

i have filled my wild card with abcdefghij.

if i want to print "zxzx" which i haven't written in wild card then it's giving quesion marks again...i have to make it works in this case also... why because we can not write all the chacters in wild card .....please help me...

Like

Reply

Select as Best

I recommend adding the entire ASCII character set to your wildcard range for the font that you are using. This will allow you to leave your TextArea blank.

In your Wildcard Ranges field enter the values: 0x20-0x7e

0690X00000D8CmZQAV.png

prathima
Associate II

i was trying by writting A-F in wildcard character under typoghrapies under texts in touchgfx but if i write "AvgdbdvZ" in my buffer...

it is displaying "A??????F" it is treating it as A and - and F but it should take all characters ...what is the issue in this case

 char buff[20] = "AvgdbdvZ";

 Unicode::strncpy(textArea1Buffer, buff,20);

     textArea1.invalidate();

     textArea1.setWildcard(textArea1Buffer);

      textArea1.resizeToCurrentText();

       textArea1.invalidate();

i have written code like this....

This is the code that I have that works:

char string[20]="AvgdbdvZ";
touchgfx::Unicode::UnicodeChar dst[20];
Unicode::strncpy(dst, string, 20);
Unicode::snprintf(testOutputTextAreaBuffer, TESTOUTPUTTEXTAREA_SIZE, "%s", testOutputTextAreaBuffer, dst);
testOutputTextArea.invalidate();
 

prathima
Associate II

sry:) dear JHard it is working fine now...issue fixed

thank you very much....