The controls in the sub page of the "lv_menu" menu component cannot slide automatically according to the focus of the key group

Description

The controls in the “lv_menu_page_create” sub page of the “lv_menu” menu component cannot automatically slide with the lv_group_focus_prev (group) as in the main menu

What MCU/Processor/Board and compiler are you using?

What LVGL version are you using?

v8.3.10

What do you want to achieve?

I use external keys to control the UI. My goal is that when the number of controls on the sub page (sub_page=lv_menu_page_create (menu, NULL)) of the “lv_menu” menu component exceeds the screen resolution, when you press the key to select a control that exceeds the screen resolution, you can automatically scroll to the selected key. The menu item of the main menu can automatically scroll without additional configuration. Why does the sub menu page not have this feature?

What have you tried so far?

lv_obj_add_flag(section, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_add_flag(section, LV_OBJ_FLAG_SCROLLABLE); /// Flags

All objects on the subMenu page, if they are added to a group, and the group is controlled by the set INDEV device, and if the object has the specified flag bits, the object will be focused and visible on the screen, automatic movement will occur when the object is focused

1 Like

Thank you very much for receiving your guidance.
In theory, it is exactly the same as you said, because my main menu uses key groups, and the focus beyond the screen can automatically slide. However, when the same method is used on the submenu, it will fail. It can be seen that controls within the screen display range can indeed switch focus one by one by pressing the key, but when focusing on controls outside the screen, it will not automatically scroll up. It is worth noting that scrollbar is displayed on the right edge of the parent control. I believe that if you use the touch screen instead of the key group, this problem will not be encountered. Therefore, I think that the special processing of the submenu of lv_menu caused this bug

I use the same version of LVGL, and the menu works for me.

Give a piece of code where you use the function lv_menu_cont_create() and lv_menu_set_load_page_event and lv_obj_add_flag(subMenu, LV_OBJ_FLAG_SCROLL_ON_FOCUS);