Skip to main content
hdmi87
Associate II
Jun 2, 2020 12:08 PM UTC
Question

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

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
Jun 2, 2020 12:34 PM UTC

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
Jun 4, 2020 4:00 AM UTC

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.