Can we have different color for different characters in a text?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-23 5:10 AM
So assume I define a text area widget which contained text "123". Can we have e.g. color gray for character '1', color black for character '2' and color red for character '3'?
The usage is e.g. to take user input via numpad, and we want to show user which character has been edited, just edited and going to be edited accordingly.
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-24 7:07 AM
Doubtful
Try: Overlapping textboxes
- top one has the highlighted colour
- fixed width font same in both so spaces and chars align
- option: bold in the "edit char text box", but that may cause spaces to be wider and mess up spacing
Try: single char edit box, with origin moved to position it over the "edit char"
- easier with fixed width font in main text box (theoretically could support variable width font if you make a table of "char widths" to calculate origin)
- Bonus: Can use bold and colour for edit char as don't depend on width of spaces
- Bonus: Can also use reverse font (black on grey instead of white on black), can even alternate the reverse normal font for blinking edit char effect.
- Bonus: Text box doesn't need to be transparent since doesn't rely on transparent spaces to show text behind
Try: Overlapping rectangle that hovers over "edit character", no change to text box, just highlights or blinks on the selected edit char
- easier if fixed width font
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-24 7:07 AM
Doubtful
Try: Overlapping textboxes
- top one has the highlighted colour
- fixed width font same in both so spaces and chars align
- option: bold in the "edit char text box", but that may cause spaces to be wider and mess up spacing
Try: single char edit box, with origin moved to position it over the "edit char"
- easier with fixed width font in main text box (theoretically could support variable width font if you make a table of "char widths" to calculate origin)
- Bonus: Can use bold and colour for edit char as don't depend on width of spaces
- Bonus: Can also use reverse font (black on grey instead of white on black), can even alternate the reverse normal font for blinking edit char effect.
- Bonus: Text box doesn't need to be transparent since doesn't rely on transparent spaces to show text behind
Try: Overlapping rectangle that hovers over "edit character", no change to text box, just highlights or blinks on the selected edit char
- easier if fixed width font
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-23 4:35 PM
Thanks @Community member​ , I chose the third option.
