summaryrefslogtreecommitdiff
path: root/lib/lvgl/examples/widgets/msgbox
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lvgl/examples/widgets/msgbox')
m---------lib/lvgl0
-rw-r--r--lib/lvgl/examples/widgets/msgbox/index.rst8
-rw-r--r--lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c19
-rw-r--r--lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py10
4 files changed, 37 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl
deleted file mode 160000
-Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a
diff --git a/lib/lvgl/examples/widgets/msgbox/index.rst b/lib/lvgl/examples/widgets/msgbox/index.rst
new file mode 100644
index 00000000..04c441a3
--- /dev/null
+++ b/lib/lvgl/examples/widgets/msgbox/index.rst
@@ -0,0 +1,8 @@
+
+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
new file mode 100644
index 00000000..9ae86068
--- /dev/null
+++ b/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c
@@ -0,0 +1,19 @@
+#include "../../lv_examples.h"
+#if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
+
+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));
+}
+
+void lv_example_msgbox_1(void)
+{
+ static const char * btns[] = {"Apply", "Close", ""};
+
+ 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);
+}
+
+#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
new file mode 100644
index 00000000..9d3e7f78
--- /dev/null
+++ b/lib/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py
@@ -0,0 +1,10 @@
+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()
+