Very long text can't fully displayed on Textarea widget

I have a very long text (greater than 20k characters) that I want to display in a Textarea, but I can’t display it completely, it can only display to about 17k, the Textarea seems to have a line limit, and I have turned on LV_LABEL_LONG_TXT_HINT.

>     agreement_text = lv_textarea_create(lv_scr_act());
>     lv_obj_set_size(agreement_text, 420, 505);
>     lv_obj_align(agreement_text, LV_ALIGN_TOP_MID, 0, 155);
>     lv_obj_set_style_radius(agreement_text, 20, 0);
>     lv_obj_clear_flag(agreement_text, LV_OBJ_FLAG_CLICK_FOCUSABLE);
>     lv_textarea_set_text(agreement_text, agreement);
>     lv_obj_set_style_text_font(agreement_text, &cerapro_medium_16, 0);
>     lv_obj_set_style_text_color(agreement_text, lv_color_hex(0x57C88C), 0);
>     lv_obj_set_style_text_letter_space(agreement_text, 0.3, 0);
>     lv_obj_set_style_text_line_space(agreement_text, 4, 0);

Hi @fuso,

I expect you may need to enable large coordinates in lv_conf.h as the calculated indices start to overflow when you have many lines of text in a text box.

/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
#define LV_USE_LARGE_COORD  1

So I would suggest the first thing to try is to change this value in your configuration and rebuild the project. Hopefully this will fix your issue.

You were also wise to enable LV_LABEL_LONG_TXT_HINT this greatly increases the performance of the scrolling/drawing of the text box. :+1:

Kind Regards,

Pete

Hi Pete

Your answer solved my problem, thanks a lot

1 Like