1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

ddlist: fix setting of width settings

This commit is contained in:
Gabor Kiss-Vamosi 2019-04-19 07:15:39 +02:00
parent 0ad121865c
commit 9fc1423ef7

View File

@ -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);
}