fix(msgbox) prevent the buttons being wider than the msbgox

This commit is contained in:
Gabor Kiss-Vamosi
2021-09-24 13:03:13 +02:00
parent 5240fdda5c
commit 73e036bba7

View File

@@ -128,6 +128,7 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char *
const lv_font_t * font = lv_obj_get_style_text_font(mbox->btns, LV_PART_ITEMS); const lv_font_t * font = lv_obj_get_style_text_font(mbox->btns, LV_PART_ITEMS);
lv_coord_t btn_h = lv_font_get_line_height(font) + LV_DPI_DEF / 10; lv_coord_t btn_h = lv_font_get_line_height(font) + LV_DPI_DEF / 10;
lv_obj_set_size(mbox->btns, btn_cnt * (2 * LV_DPI_DEF / 3), btn_h); lv_obj_set_size(mbox->btns, btn_cnt * (2 * LV_DPI_DEF / 3), btn_h);
lv_obj_set_style_max_width(mbox->btns, lv_pct(100), 0);
lv_obj_add_flag(mbox->btns, LV_OBJ_FLAG_EVENT_BUBBLE); /*To see the event directly on the message box*/ lv_obj_add_flag(mbox->btns, LV_OBJ_FLAG_EVENT_BUBBLE); /*To see the event directly on the message box*/
} }