diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.cbp b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.cbp
index 1496aaf..364f89c 100644
--- a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.cbp
+++ b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.cbp
@@ -1653,10 +1653,10 @@
-
+
-
+
diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout
index 67939ba..dfee90e 100644
--- a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout
+++ b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout
@@ -2,15 +2,253 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
@@ -25,21 +263,32 @@
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
@@ -47,19 +296,29 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -67,89 +326,14 @@
-
+
-
+
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lvgl_win_sim/lv_port_win_codeblocks/menu_screen.c
index 95b739a..1a33964 100644
--- a/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.c
+++ b/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.c
@@ -148,28 +148,37 @@ void menu_screen_create(MenuScreen_t * const menuScreen)
//We add the screen header
common_screen_header_component(menuScreen->display, "Menu", 50);
- lv_obj_t *scroll_item_container = lv_obj_create(menuScreen->display);
- lv_obj_set_style_bg_color(scroll_item_container, lv_color_white(), LV_PART_MAIN);
- lv_obj_set_size(scroll_item_container, lv_pct(100), 240-50);
- lv_obj_set_pos(scroll_item_container, 0, 50);
- lv_obj_set_style_pad_all(scroll_item_container, 0, LV_PART_MAIN);
- lv_obj_set_style_pad_top(scroll_item_container, 10, LV_PART_MAIN);
- lv_obj_set_style_pad_bottom(scroll_item_container, 20, LV_PART_MAIN);
- lv_obj_set_style_radius(scroll_item_container, 0, LV_PART_MAIN);
- lv_obj_set_style_border_width(scroll_item_container, 0, LV_PART_MAIN);
- lv_obj_set_style_pad_right(scroll_item_container, 15, LV_PART_SCROLLBAR);
+ if(menuScreen->scrollItemContainer)
+ {
+ LV_LOG_ERROR("scrollItemContainer should be NULL here !");
+ lv_obj_del(menuScreen->scrollItemContainer);
+ menuScreen->scrollItemContainer = NULL;
+ }
+ menuScreen->scrollItemContainer = lv_obj_create(menuScreen->display);
+ lv_obj_set_style_bg_color(menuScreen->scrollItemContainer, lv_color_white(), LV_PART_MAIN);
+ lv_obj_set_size(menuScreen->scrollItemContainer, lv_pct(100), 240-50);
+ lv_obj_set_pos(menuScreen->scrollItemContainer, 0, 50);
+ lv_obj_set_style_pad_all(menuScreen->scrollItemContainer, 0, LV_PART_MAIN);
+ lv_obj_set_style_pad_top(menuScreen->scrollItemContainer, 10, LV_PART_MAIN);
+ lv_obj_set_style_pad_bottom(menuScreen->scrollItemContainer, 20, LV_PART_MAIN);
+ lv_obj_set_style_radius(menuScreen->scrollItemContainer, 0, LV_PART_MAIN);
+ lv_obj_set_style_border_width(menuScreen->scrollItemContainer, 0, LV_PART_MAIN);
+ lv_obj_set_style_pad_right(menuScreen->scrollItemContainer, 15, LV_PART_SCROLLBAR);
- menu_screen_add_item(scroll_item_container, 0, &watch_menu_clock_icon, "Watch", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 1, &watch_menu_alarm_icon, "Alarm", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 2, &watch_menu_music_player_icon, "Music player", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 3, &watch_menu_compass_icon, "Compass", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 4, &watch_menu_altimeter_icon, "Altimeter", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 5, &watch_menu_lost_phone_icon, "Find my phone", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 0, &watch_menu_clock_icon, "Watch", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 1, &watch_menu_alarm_icon, "Alarm", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 2, &watch_menu_music_player_icon, "Music player", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 3, &watch_menu_compass_icon, "Compass", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 4, &watch_menu_altimeter_icon, "Altimeter", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 5, &watch_menu_lost_phone_icon, "Find my phone", &(menu_item_cb));
//menu_screen_add_item(scroll_item_container, 3, &watch_menu_messages_icon, "Text messages", &(menu_item_cb));
//menu_screen_add_item(scroll_item_container, 4, &watch_menu_mail_icon, "Mails", &(menu_item_cb));
//menu_screen_add_item(scroll_item_container, 5, &watch_menu_dialer_icon, "Phone", &(menu_item_cb));
//menu_screen_add_item(scroll_item_container, 6, &watch_menu_contacts_icon, "Contacts", &(menu_item_cb));
- menu_screen_add_item(scroll_item_container, 6, &watch_menu_settings_icon, "Settings", &(menu_item_cb));
+ menu_screen_add_item(menuScreen->scrollItemContainer, 6, &watch_menu_settings_icon, "Settings", &(menu_item_cb));
+
+ //Lets restore the previous scrolling position
+ lv_obj_scroll_to_y(menuScreen->scrollItemContainer, menuScreen->lastScrollPosition, LV_ANIM_OFF);
//We register the event callback to handle the cleanup
lv_obj_add_event_cb(menuScreen->display, &(cleanup_event_cb), LV_EVENT_DELETE, menuScreen);
@@ -183,5 +192,7 @@ void menu_screen_destroy(MenuScreen_t * const menuScreen)
return;
}
- menuScreen->display = NULL;
+ //Lets save the current scroll position
+ menuScreen->lastScrollPosition = lv_obj_get_scroll_y(menuScreen->scrollItemContainer);
+ memset(menuScreen, 0, offsetof(MenuScreen_t, lastScrollPosition));
}
diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.h b/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.h
index a0806af..7166520 100644
--- a/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.h
+++ b/src/lvgl_win_sim/lv_port_win_codeblocks/menu_screen.h
@@ -6,7 +6,11 @@
// Menu screen context object
typedef struct MenuScreen
{
+ //Can be erased attributes
lv_obj_t *display;
+ lv_obj_t *scrollItemContainer;
+ //Should not be erased attributes
+ lv_coord_t lastScrollPosition;
} MenuScreen_t;
/* Initializes the menu screen context object */