2021-04-08 13:07:48 +02:00
|
|
|
#include "../../lv_examples.h"
|
2021-02-14 14:56:34 +01:00
|
|
|
#if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
|
2021-02-08 09:53:03 +01:00
|
|
|
|
2021-04-14 15:31:54 +02:00
|
|
|
static void event_cb(lv_event_t * e)
|
2021-02-08 09:53:03 +01:00
|
|
|
{
|
2023-03-06 12:47:18 +01:00
|
|
|
lv_obj_t * obj = lv_event_get_target(e);
|
2022-10-10 21:31:29 +08:00
|
|
|
LV_UNUSED(obj);
|
2023-09-14 20:12:31 +02:00
|
|
|
LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_button_text(obj));
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void lv_example_msgbox_1(void)
|
|
|
|
{
|
2023-09-14 20:12:31 +02:00
|
|
|
static const char * buttons[] = {"Apply", "Close", ""};
|
2021-02-08 09:53:03 +01:00
|
|
|
|
2023-09-14 20:12:31 +02:00
|
|
|
lv_obj_t * mbox1 = lv_msgbox_create(NULL, "Hello", "This is a message box with two buttons.", buttons, true);
|
2023-02-20 20:50:58 +01:00
|
|
|
lv_obj_add_event(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_center(mbox1);
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|