Skip to main content
GMeur
Associate III
May 21, 2019
Solved

TextAreaWildCard displaying too many characters

  • May 21, 2019
  • 2 replies
  • 2073 views

Hi,

Imagine I have a vector of 10 different text Areas and I want to write a different number ranging from 0 to 9 on each of them (0 on the first one, 1 on the second and so on). What's the best strategy to achieve this?

Using a wildcard definitely seems inappropriate as once the textAreas will be set up, they won't be changed for the whole duration of the program. Comparably, using a Resource with the need to introduce first all the characters in the 'database' seems overkilled. They must be another way, more appropriate and doable directly from the code.

Thanks in advance.

This topic has been closed for replies.
Best answer by Martin KJELDSEN

TouchGFX operates on strings of Unicode chars. The strings need to be escaped with '\0' - So your buffers should all be of size 2.

2 replies

Martin KJELDSEN
Principal III
May 21, 2019

Hi @GMeur​,

Using a wildcard buffer for each TextArea is definitely the way to go here.

/Martin

Martin KJELDSEN
Principal III
May 21, 2019

Just to exemplify on the first option: You would have to define ten text resources and then write code that determine which of these texts should be set based on a number. This leads to more flash usage, while the second more generic/elegant solution would require less flash but more ram. I guess, sometimes when you're resource constrained you have to consider things like this.

/Martin

GMeur
GMeurAuthor
Associate III
May 22, 2019

Is there a way to limit the size of a given buffer used to draw a test string in a textArea? I explain you why I'm asking that. If I wanna create 10 buffers holding one character each, the simplest solution would be to create an array of 10 characters. But what's that? A buffer of size 10 instead of being 10 buffers of size 1. When assigning the textBuffer it'd be awesome if I could set its size too. How can I do that easily? Thanks.