How to create modal with LVGL 8+

What I’m trying to do is to use what MessageBox provides. But instead of putting text inside, I want to add two imgbtn elements, it is possible with the current MessageBox, or should I have to create my own component?

Seems like I’m completely stupid, it’s really easy:

  static const char* btns[] = {""};
  lv_obj_t* choice_box = lv_msgbox_create(NULL, "Choice wisely", "", btns, true);

  lv_obj_t* test = lv_imgbtn_create(choice_box);
  lv_imgbtn_set_src(test, LV_IMGBTN_STATE_RELEASED, NULL, &image, NULL);

That’s all

1 Like