Skip to main content
hdmi87
Associate II
June 2, 2020
Question

How to highlight part of text in TextArea widget using TouchGFX with other color?

  • June 2, 2020
  • 2 replies
  • 1436 views

I need a widget that contains text with black characters on white background, and some of characters inverted - white on black background (like on attached image). How is it possible to do this with TouchGFX library?

This topic has been closed for replies.

2 replies

Martin KJELDSEN
Principal III
June 2, 2020

Sounds like a custom widget where you, besides drawing the text. take a lock on the framebuffer and invert the pixels for the characters you need. But you cannot access a text like that so you'll have to calculate where from and where to you would like to do this inversion of pixels (e.g. read white? write black, and vice versa).

/Martin

hdmi87
hdmi87Author
Associate II
June 4, 2020

One possible way to determine where the highlighted part of text is is to use ListLayout and split TextArea into three separate TextAreas: the first - for text before highlighted piece, the second - for the highlighted part, and the third - for the remaining text.