From 64bd9053a25297f7a442ca831c7da5b44bd33f84 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 12 Jun 2024 17:54:40 +1000 Subject: Update LVGL to v9.1.0 --- lib/lvgl/examples/widgets/msgbox/index.rst | 2 +- .../examples/widgets/msgbox/lv_example_msgbox_1.c | 22 ++++++++++++++++------ .../examples/widgets/msgbox/lv_example_msgbox_1.py | 10 ---------- 3 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py (limited to 'lib/lvgl/examples/widgets/msgbox') diff --git a/lib/lvgl/examples/widgets/msgbox/index.rst b/lib/lvgl/examples/widgets/msgbox/index.rst index 04c441a3..8056e5dc 100644 --- a/lib/lvgl/examples/widgets/msgbox/index.rst +++ b/lib/lvgl/examples/widgets/msgbox/index.rst @@ -1,6 +1,6 @@ Simple Message box -""""""""""""""""""" +------------------ .. lv_example:: widgets/msgbox/lv_example_msgbox_1 :language: c diff --git a/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c b/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c index 9ae86068..9591ce32 100644 --- a/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c +++ b/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c @@ -3,17 +3,27 @@ static void event_cb(lv_event_t * e) { - lv_obj_t * obj = lv_event_get_current_target(e); - LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); + lv_obj_t * btn = lv_event_get_target(e); + lv_obj_t * label = lv_obj_get_child(btn, 0); + LV_UNUSED(label); + LV_LOG_USER("Button %s clicked", lv_label_get_text(label)); } void lv_example_msgbox_1(void) { - static const char * btns[] = {"Apply", "Close", ""}; + lv_obj_t * mbox1 = lv_msgbox_create(NULL); - lv_obj_t * mbox1 = lv_msgbox_create(NULL, "Hello", "This is a message box with two buttons.", btns, true); - lv_obj_add_event_cb(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL); - lv_obj_center(mbox1); + lv_msgbox_add_title(mbox1, "Hello"); + + lv_msgbox_add_text(mbox1, "This is a message box with two buttons."); + lv_msgbox_add_close_button(mbox1); + + lv_obj_t * btn; + btn = lv_msgbox_add_footer_button(mbox1, "Apply"); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL); + btn = lv_msgbox_add_footer_button(mbox1, "Cancel"); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL); + return; } #endif diff --git a/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py b/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py deleted file mode 100644 index 9d3e7f78..00000000 --- a/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py +++ /dev/null @@ -1,10 +0,0 @@ -def event_cb(e): - mbox = e.get_current_target() - print("Button %s clicked" % mbox.get_active_btn_text()) - -btns = ["Apply", "Close", ""] - -mbox1 = lv.msgbox(lv.scr_act(), "Hello", "This is a message box with two buttons.", btns, True) -mbox1.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None) -mbox1.center() - -- cgit v1.2.3