diff --git a/docs/widgets/core/textarea.md b/docs/widgets/core/textarea.md index 7e42f2f17..5f6b50e8c 100644 --- a/docs/widgets/core/textarea.md +++ b/docs/widgets/core/textarea.md @@ -74,11 +74,6 @@ In password mode `lv_textarea_get_text(textarea)` returns the actual text entere The visibility time can be adjusted with `LV_TEXTAREA_DEF_PWD_SHOW_TIME)` in `lv_conf.h`. -### Text alignment - -To align the text in the Text area ` lv_textarea_set_align(textarea, LV_TEXT_ALIGN_LEFT/RIGHT/CENTER)` needs to be used instead of setting the `text_align` style property. - - ### Accepted characters You can set a list of accepted characters with `lv_textarea_set_accepted_chars(textarea, "0123456789.+-")`. Other characters will be ignored. diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index a4ae81eb5..5ca0fbe06 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -489,6 +489,7 @@ void lv_textarea_set_one_line(lv_obj_t * obj, bool en) if(en) { ta->one_line = 1; lv_obj_set_width(ta->label, LV_SIZE_CONTENT); + lv_obj_set_style_min_width(ta->label, lv_pct(100), 0); lv_obj_set_height(obj, LV_SIZE_CONTENT); lv_obj_scroll_to(obj, 0, 0, LV_ANIM_OFF); @@ -496,6 +497,7 @@ void lv_textarea_set_one_line(lv_obj_t * obj, bool en) else { ta->one_line = 0; lv_obj_set_width(ta->label, lv_pct(100)); + lv_obj_set_style_min_width(ta->label, 0, 0); lv_obj_remove_local_style_prop(obj, LV_STYLE_HEIGHT, LV_PART_MAIN); lv_obj_scroll_to(obj, 0, 0, LV_ANIM_OFF); } @@ -553,6 +555,7 @@ void lv_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time) void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align) { + LV_LOG_WARN("Deprecated: use the normal text_align style property instead"); lv_obj_set_style_text_align(obj, align, 0); switch(align) { diff --git a/src/widgets/lv_textarea.h b/src/widgets/lv_textarea.h index 0964416d4..2ab48f0ab 100644 --- a/src/widgets/lv_textarea.h +++ b/src/widgets/lv_textarea.h @@ -199,6 +199,7 @@ void lv_textarea_set_text_selection(lv_obj_t * obj, bool en); void lv_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time); /** + * Deprecated: use the normal text_align style property instead * Set the label's alignment. * It sets where the label is aligned (in one line mode it can be smaller than the text area) * and how the lines of the area align in case of multiline text area