I am trying to create a “log window”: a text window containing N lines. New lines are added to the bottom, and when the window is filled with all the N lines, adding a new line causes the top one to disappear.
I am using version 7 of the library on a M5Stack FIRE board (ESP32 based).
Currently I am trying to do it using the textarea
widget. This is what I tried:
- For the first attempt I just tried adding lines one by one using
lv_textarea_add_text()
and behavior is the same I want. But unfortunately when you reach the maximum configured length, as expected the library will not allow adding more text. - For the second attempt, I tried managing myself the buffer with the lines I want to draw. Then each time I want to add a line, I add it to my buffer and then call
lv_textarea_set_text()
passing it my manually managed buffer. This works, but performance is VERY low, much lower than with the previous method.
I could try deleting the text directly from the textarea using LVGL functions (in this case which is best, deleting characters one by one or configuring a selection and deleting the selection?). But I suspect this might also be problematic performance wise.
I am also considering trying using lists. Would this work? Would performance be better?
Thanks for the help and suggestions!