1 #include "../../lv_examples.h"
2 #if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
3
event_cb(lv_event_t * e)4 static void event_cb(lv_event_t * e)
5 {
6 lv_obj_t * obj = lv_event_get_current_target(e);
7 LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj));
8 }
9
lv_example_msgbox_1(void)10 void lv_example_msgbox_1(void)
11 {
12 static const char * btns[] = {"Apply", "Close", ""};
13
14 lv_obj_t * mbox1 = lv_msgbox_create(NULL, "Hello", "This is a message box with two buttons.", btns, true);
15 lv_obj_add_event_cb(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL);
16 lv_obj_center(mbox1);
17 }
18
19 #endif
20