1 #include "../../lv_examples.h"
2 #if LV_USE_MENU && LV_BUILD_EXAMPLES
3 
lv_example_menu_1(void)4 void lv_example_menu_1(void)
5 {
6     /*Create a menu object*/
7     lv_obj_t * menu = lv_menu_create(lv_scr_act());
8     lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
9     lv_obj_center(menu);
10 
11     lv_obj_t * cont;
12     lv_obj_t * label;
13 
14     /*Create a sub page*/
15     lv_obj_t * sub_page = lv_menu_page_create(menu, NULL);
16 
17     cont = lv_menu_cont_create(sub_page);
18     label = lv_label_create(cont);
19     lv_label_set_text(label, "Hello, I am hiding here");
20 
21     /*Create a main page*/
22     lv_obj_t * main_page = lv_menu_page_create(menu, NULL);
23 
24     cont = lv_menu_cont_create(main_page);
25     label = lv_label_create(cont);
26     lv_label_set_text(label, "Item 1");
27 
28     cont = lv_menu_cont_create(main_page);
29     label = lv_label_create(cont);
30     lv_label_set_text(label, "Item 2");
31 
32     cont = lv_menu_cont_create(main_page);
33     label = lv_label_create(cont);
34     lv_label_set_text(label, "Item 3 (Click me!)");
35     lv_menu_set_load_page_event(menu, cont, sub_page);
36 
37     lv_menu_set_page(menu, main_page);
38 }
39 
40 #endif
41