2021-04-08 13:07:48 +02:00
|
|
|
#include "../../lv_examples.h"
|
2021-02-14 14:56:34 +01:00
|
|
|
#if LV_USE_WIN && LV_BUILD_EXAMPLES
|
2021-02-08 09:53:03 +01:00
|
|
|
|
|
|
|
|
2021-04-14 15:31:54 +02:00
|
|
|
static void event_handler(lv_event_t * e)
|
2021-02-08 09:53:03 +01:00
|
|
|
{
|
2021-04-14 15:31:54 +02:00
|
|
|
lv_event_code_t code = lv_event_get_code(e);
|
|
|
|
lv_obj_t * obj = lv_event_get_target(e);
|
|
|
|
if(code == LV_EVENT_CLICKED) {
|
2021-03-11 12:21:03 +01:00
|
|
|
LV_LOG_USER("Button %d clicked", lv_obj_get_child_id(obj));
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void lv_example_win_1(void)
|
|
|
|
{
|
|
|
|
lv_obj_t * win = lv_win_create(lv_scr_act(), 60);
|
|
|
|
lv_win_add_btn(win, LV_SYMBOL_LEFT, 40, event_handler);
|
|
|
|
lv_win_add_title(win, "A title");
|
|
|
|
lv_win_add_btn(win, LV_SYMBOL_RIGHT, 40, event_handler);
|
|
|
|
lv_win_add_btn(win, LV_SYMBOL_CLOSE, 60, event_handler);
|
|
|
|
|
|
|
|
lv_obj_t * cont = lv_win_get_content(win); /*Content can be aded here*/
|
2021-03-25 13:36:50 +01:00
|
|
|
lv_obj_t * label = lv_label_create(cont);
|
2021-02-08 09:53:03 +01:00
|
|
|
lv_label_set_text(label, "This is\n"
|
|
|
|
"a pretty\n"
|
|
|
|
"long text\n"
|
|
|
|
"to see how\n"
|
|
|
|
"the window\n"
|
|
|
|
"becomes\n"
|
|
|
|
"scrollable.\n"
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"Some more\n"
|
|
|
|
"text to be\n"
|
|
|
|
"sure it\n"
|
|
|
|
"overflows. :)");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|