cancel
Showing results for 
Search instead for 
Did you mean: 

Using text resources in wildcard or directly in text area

CKauf
Associate III

Hello,

I noticed that in TouchGFX Designer there are two ways of using a text resource in a text area:

  1. Set the text area to use a Resource, choose the resource ID.
  2. Set text area to Single Use, create a wildcard, set Wildcard to use a Resource, choose the resource ID.

Both ways seem to work just fine (as one would suspect).

But are there differences between the two (e.g. memory usage or available features) that would make one preferable in certain situations?

Kind regards

Christoph

5 REPLIES 5
Alexandre RENOUX
Principal

Hello,

It's always better to create Resources because as you said you can change the ID to be understandable (T_SINGLEUSEID3 is not very self-explanatory).

Plus the point of Resources is that they can be reused. For every Single Use text you will allocate memory for it. But let's say you want to have the word "quit" on several screens. For this case, you will declare "quit" as a resource only once and use it for every occurrence. Therefore you save memory and text management becomes way easier.

/Alexandre

Alexandre RENOUX
Principal

(I forgot to add the purpose of wildcard)

There are 2 main situations where wildcards are useful:

  1. If you want to change a word in a sentence. For example: My name is <name>. You will not create a Resource for every name like "My name is Robert" then "My name is Christopher" or "My name is Nicolas". You will have one text "My name is <name>" and only <name> will change.
  2. If you want to apply a word with different font and size according to if it’s a title, subtitle, part of a paragraph, etc. For example: The headline is <Title>, size 40 and you have a word that must change depending on some selection in the paragraph (size 20) but both need to be the word “TouchGFX�?. Then you create one unique “TouchGFX�? resource and apply it to the two TextAreas with different font size.

/Alexandre

CKauf
Associate III

Hello Alexandre,

thank you for your helpful explanation.

So the typography and alignment of the wildcard always takes precedence over the typography and alignment set in the recource.

One more question:

As you said, there is a new text created for every Single Use. So for every textarea that contains only a wildcard there will be a "<value>" single use ID. This means, if I have a lot of wildcards, I can save a bit of memory by choosing short or even empty wildcard names. Is that correct?

Christoph

Hello,

No, wildcard names are just there to help the user but they won't be taken into account in the program. They will be replaced by a placeholder number so you can even put a sentence like <This a very very long name for a wildcard> and it will take as much memory as <>.

Another thing to notice is that if you have 4 Single Use text "Hello World" in your application, they will be all merged into one after compilation. However, it is a very bad habit and resources should be prioritized.

You might find other information if you follow this link : https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/texts-and-fonts#wildcards

/Alexandre

Hello Alexandre,

thank you very much for those clarifications.

Best regards

Christoph