Lv_ menu do not support focusing?

lv_ menu do not support focusing? How to use this control if it is a keyboard device or an encoder device?

The menu widget was added by @HX2003. Could you take look at this question?

@zy815678396
Right now menu_cont objects are not added to the default group since there may be children objects such as sliders or switches inside which can be focusable.

You can add menu_cont manually using lv_group_add_obj(default_group, menu_cont);

@kisvegabor It is possible to apply the focused style to the parent object if any of the child objects are focused, last time I did in V7 was a little hacky.

Hmm, you can make add LV_OBJ_FLAG_EVENT_BUBBLE flag to the children, add an event callback to the parent and manually add/remove LV_STATE_FOCUSED to the parent on LV_EVENT_FOCUSED/DEFOCUSED.

Could it work?

Sorry to up an old topic.
Has anything changed in version 9.3.0?
I can’t get the navigation on the menu items to work using the rotary encoder from the lv_example_menu_3() example.

@liamHowatt do you know if there are any updates on this?

Make sure you have this somewhere:

    lv_group_t * g = lv_group_create();
    lv_group_set_default(g);

    lv_indev_t * indev = NULL;
    while((indev = lv_indev_get_next(indev))) {
        lv_indev_set_group(indev, g);
    }

As a test, the sliders in lv_example_menu_5 should work.

To get lv_example_menu_3 to work, add these lv_group_add_obj(lv_group_get_default(), cont)

image

Thanks for the reply.
I don’t understand what’s going on here, please explain.

Added it. The focus appeared, but after switching to the nested menu, I cannot return to the parent menu, e.g. there is no a focus on the item in the red circle.
not_focused