2021-04-08 13:07:48 +02:00
|
|
|
#include "../lv_examples.h"
|
2021-02-23 11:31:10 +01:00
|
|
|
#if LV_BUILD_EXAMPLES
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Demonstrate how scrolling appears automatically
|
|
|
|
*/
|
|
|
|
void lv_example_scroll_1(void)
|
|
|
|
{
|
|
|
|
/*Create an object with the new style*/
|
2023-10-12 20:37:27 +02:00
|
|
|
lv_obj_t * panel = lv_obj_create(lv_screen_active());
|
2021-02-23 11:31:10 +01:00
|
|
|
lv_obj_set_size(panel, 200, 200);
|
|
|
|
lv_obj_center(panel);
|
|
|
|
|
|
|
|
lv_obj_t * child;
|
|
|
|
lv_obj_t * label;
|
|
|
|
|
2021-03-25 13:36:50 +01:00
|
|
|
child = lv_obj_create(panel);
|
2021-02-23 11:31:10 +01:00
|
|
|
lv_obj_set_pos(child, 0, 0);
|
2021-05-26 16:34:25 +02:00
|
|
|
lv_obj_set_size(child, 70, 70);
|
2021-03-25 13:36:50 +01:00
|
|
|
label = lv_label_create(child);
|
2021-02-23 11:31:10 +01:00
|
|
|
lv_label_set_text(label, "Zero");
|
|
|
|
lv_obj_center(label);
|
|
|
|
|
2021-03-25 13:36:50 +01:00
|
|
|
child = lv_obj_create(panel);
|
2021-05-26 16:34:25 +02:00
|
|
|
lv_obj_set_pos(child, 160, 80);
|
|
|
|
lv_obj_set_size(child, 80, 80);
|
2021-02-23 11:31:10 +01:00
|
|
|
|
2023-09-14 20:12:31 +02:00
|
|
|
lv_obj_t * child2 = lv_button_create(child);
|
2021-05-26 16:34:25 +02:00
|
|
|
lv_obj_set_size(child2, 100, 50);
|
2021-02-23 11:31:10 +01:00
|
|
|
|
2021-05-26 16:34:25 +02:00
|
|
|
label = lv_label_create(child2);
|
2021-02-23 11:31:10 +01:00
|
|
|
lv_label_set_text(label, "Right");
|
|
|
|
lv_obj_center(label);
|
|
|
|
|
2021-03-25 13:36:50 +01:00
|
|
|
child = lv_obj_create(panel);
|
2021-05-26 16:34:25 +02:00
|
|
|
lv_obj_set_pos(child, 40, 160);
|
|
|
|
lv_obj_set_size(child, 100, 70);
|
2021-03-25 13:36:50 +01:00
|
|
|
label = lv_label_create(child);
|
2021-02-23 11:31:10 +01:00
|
|
|
lv_label_set_text(label, "Bottom");
|
|
|
|
lv_obj_center(label);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|