From 9fc1423ef7b26ad4020a3023074246ec5843d9cb Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 19 Apr 2019 07:15:39 +0200 Subject: [PATCH] ddlist: fix setting of width settings --- src/lv_objx/lv_ddlist.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index 811108a6c..887f37e4b 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -171,11 +171,18 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options) for(i = 0; options[i] != '\0'; i++) { if(options[i] == '\n') ext->option_cnt++; } - ext->option_cnt++; /*Last option in the at row*/ + ext->option_cnt++; /*Last option has no `\n`*/ ext->sel_opt_id = 0; ext->sel_opt_id_ori = 0; lv_label_set_text(ext->label, options); + + /*Set the TIGHT fit horizontally the set the width the content*/ + lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, LV_FIT_TIGHT); + + /*Revert FILL fit to fill the parent with the options area. It allows to RIGHT/CENTER align the text*/ + lv_page_set_scrl_fit2(ddlist, LV_FIT_FILL, LV_FIT_TIGHT); + lv_ddlist_refr_size(ddlist, false); }