cancel
Showing results for 
Search instead for 
Did you mean: 

setTypedText & Unicode::snprintf on the same textArea

justin11
Associate III

i have a textArea called endPoint_Value which i would like to write both text from the TypeText ids using the setTypedText, but i also on different occations need to use the Unicode::snprintf & Unicode::snprintFloat

The textArea has a wildcard and buffer applied to in in TouchGFX Designer

Unicode::snprintf ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%d", *( menu_ActiveEndPoint->Value_u8 ) );
 
 
Unicode::snprintfFloat ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%02.1f", *( menu_ActiveEndPoint->Value_f ) );
 
 
endPoint_Value.setTypedText ( TypedText ( T_MNUDEVICE_CONFIG ) );

each of these line work perfectly and the text changes as expected.

However, as soon as i use the "setTypedText" the "snprintf" no longer seems to work on the textArea.

I do use the endPoint_Value.invalidate ();

It seems the textArea is no longer attached to the wildcard or something like that. i've tried the endPoint_Value.setWildcard (endPoint_ValueBuffer);, but that hasn't helped.

Any suggestions whats happening ?

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
JTP1
Lead

If you sometimes use setTypedText- function, you must then set back the original text resource to get wildcard buffer text visible again. Something like this:

endPoint_Value.setTypedText ( TypedText ( T___SINGLEUSE_FZH0) ); // check the base class cpp- file to find out your wildcardbuffer resource name, T___SINGLEUSE_FZH0 is just example
 
// after that this works:
Unicode::snprintf ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%d", *( menu_ActiveEndPoint->Value_u8 ) );

Or you can simply print constant text like this to avoid hole problem (maybe easier):

Unicode::snprintf ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%s",TypedText(T_MNUDEVICE_CONFIG ).getText());

View solution in original post

2 REPLIES 2
JTP1
Lead

If you sometimes use setTypedText- function, you must then set back the original text resource to get wildcard buffer text visible again. Something like this:

endPoint_Value.setTypedText ( TypedText ( T___SINGLEUSE_FZH0) ); // check the base class cpp- file to find out your wildcardbuffer resource name, T___SINGLEUSE_FZH0 is just example
 
// after that this works:
Unicode::snprintf ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%d", *( menu_ActiveEndPoint->Value_u8 ) );

Or you can simply print constant text like this to avoid hole problem (maybe easier):

Unicode::snprintf ( endPoint_ValueBuffer, ENDPOINT_VALUE_SIZE, "%s",TypedText(T_MNUDEVICE_CONFIG ).getText());

fantastic !! thant makes perfect sense, cheers