cancel
Showing results for 
Search instead for 
Did you mean: 

Can I change the text rendering?

MWate.1
Associate II

I want to make a TextBox with a cursor (caret) and would like to change the TextAreaWithOneWildcard. Where can I see the implementation of the draw method? Is this code open?

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III
touchgfx/widgets

You can inspect the draw methods of the text areas. `TextAreaWithOneWildcard` inherits from `TextArea`

Imagine that you have a widget of type `TextArea` that is time aware using:

Application::getInstance()->registerTimerWidget(this);

You can now receive ticks in:

void MyCustomTextArea::handleTickEvent()
{

And blink a cursor/caret at some interval. Now it's your job to move the caret as the TextArea receives new input (from the application). You can do this by moving the caret to the end of the text (you can get the total width of the text) or if you want to support editing at some location in the text,.

View solution in original post

4 REPLIES 4
Martin KJELDSEN
Chief III
touchgfx/widgets

You can inspect the draw methods of the text areas. `TextAreaWithOneWildcard` inherits from `TextArea`

Imagine that you have a widget of type `TextArea` that is time aware using:

Application::getInstance()->registerTimerWidget(this);

You can now receive ticks in:

void MyCustomTextArea::handleTickEvent()
{

And blink a cursor/caret at some interval. Now it's your job to move the caret as the TextArea receives new input (from the application). You can do this by moving the caret to the end of the text (you can get the total width of the text) or if you want to support editing at some location in the text,.

thx, and standard implementations of this in libraries? I understand correctly that touchgfx is free but not open source?

Not open source, and free on STM32 yes 🙂 There's no standard widget that gives you a cursor, but you could do it "easy" on your own!

/Martin

huh, that's good, but the source is interesting)