1.How set styles to Message box (lv_msdbox) buttons? 2. Or even set default style which use in all objects to our new-defined style?

1.How set styles to Message box (lv_msdbox) buttons?

 static const char * btns[] ={"Yes", "No", ""};

    lv_obj_t * mbox = lv_msgbox_create(lv_scr_act(), NULL); // 
    lv_mbox_create(lv_disp_get_layer_top(NULL), NULL);
    lv_msgbox_set_text(mbox, "Are you sure?");
    lv_msgbox_add_btns(mbox, btns);
    lv_obj_set_width(mbox, 200);
    lv_obj_set_event_cb(mbox, msgbox_FactoryReset_event_handler);
    lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the corner*/
  1. Or even set default style which use in all objects to our new one?

Take a look at the documentation.

You can extend a theme to do this.

Hi, I mean for example one button of Message-box eg: “Yes” become red and another eg:“No” blue?

and about my 2nd question, would you give me a complete example?
I mean how could import style1 inside custom_theme?

 /*Get the current theme (e.g. material). It will be the base of the custom theme.*/   
lv_theme_t * base_theme = lv_theme_get_act();

/*Initialize a custom theme*/
static lv_theme_t custom_theme;                         /*Declare a theme*/
lv_theme_copy(&custom_theme, )base_theme;               /*Initialize the custom theme from the base theme*/                           
lv_theme_set_apply_cb(&custom_theme, custom_apply_cb);  /*Set a custom theme apply callback*/
lv_theme_set_base(custom_theme, base_theme);            /*Set the base theme of the csutom theme*/

/*Initialize styles for the new theme*/
static lv_style_t style1;
lv_style_init(&style1);
lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, custom_theme.color_primary);

...

/*Add a custom apply callback*/
static void custom_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
{
    lv_style_list_t * list;

    switch(name) {
        case LV_THEME_BTN:
            list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
            _lv_style_list_add_style(list, &my_style);
            break;
    }
}

In the widgets demo I made one button checked in which the button has different color.

Thanx Gabor.
So we can edit each buttons width by lv_btnmatrix_set_btn_width(lv_obj_t *btnm, uint16_t btn_id, uint8_t width)
and for changing each btn’s state: void lv_btnmatrix_set_btn_ctrl(const lv_obj_t *btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
where states are:
enumerator LV_BTNMATRIX_CTRL_HIDDEN = 0x0008
Button hidden
enumerator LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0010
Do not repeat press this button.
enumerator LV_BTNMATRIX_CTRL_DISABLED = 0x0020
Disable this button.
enumerator LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040
Button can be toggled.
enumerator LV_BTNMATRIX_CTRL_CHECK_STATE = 0x0080
Button is currently toggled (e.g. checked).
enumerator LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100
1: Send LV_EVENT_SELECTED on CLICK, 0: Send LV_EVENT_SELECTED on PRESS
enum [anonymous]
Values:
enumerator LV_BTNMATRIX_PART_BG
enumerator LV_BTNMATRIX_PART_BTN
lv_btnmatrix_set_btn_ctrl.

But there is no direct controlling on each btns.
So for changing one buttons style I better make new message box by creating new page.

and about make a new theme I saw “lv_theme_material.c” code and I figure-out I have to make such src.

I don’t understand. The options you mentioned are used to control each button individually.

I think @HamidSaffari is pointing out that you can’t style individual buttons of a button matrix in different ways.

@embeddedt Yes, that’s what I meant.
You can not give different lv_style_t “style”

to each individual buttons of a button matrix .

Ah, I see.

Yes, unfortunately you can’t. :frowning:

Hi
I also have a similar problem, but mine is about how to move the message box buttons, do you have any documents or advice?

here is Message box and some question around it - How-to - LVGL Forum