Disabling the focus of elements within the container object

Description

I have an object (container), inside which three CheckBoxes are placed, and additionally on the same screen (outside the container)
added another CheckBox.
I use an encoder (ie it is simulated with three hardware keys).
The container and the CheckBox outside the container are added to the group (two objects). When the focus is moved, the following are focused: the container, the checkbox inside the container, and each checkbox outside the container (5 different focuses)
I don’t think this is the right behavior, because I only added two objects to the group. If I want to select a CheckBox inside a container, then first I need to select and select the container, and only then enable the selection of individual CheckBoxes inside the container.

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

ESP32-C3, ESP-IDF v5.0

What LVGL version are you using?

v8.3.9

What do you want to achieve?

I need to change the focus of two added objects in a group. Only when I focus and select a one object(conteiner) (then you should select elements within the object)

The code block(s) should be formatted like:

void TestGroup()
{
    lv_group_remove_all_objs(g);

    lv_obj_t* holder = lv_obj_create(ui_TestDisplay);   /*Create a transparent holder*/
    lv_obj_set_pos(holder, 10, 10);
    lv_obj_set_size(holder, 170, 170);
    lv_obj_set_flex_flow(holder, LV_FLEX_FLOW_COLUMN);
    lv_obj_set_flex_align(holder, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
    lv_obj_set_style_bg_opa(holder, LV_OPA_40, 0);
    lv_obj_set_style_bg_color(holder, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(holder, lv_palette_main(LV_PALETTE_ORANGE), LV_STATE_FOCUSED);
    lv_obj_set_user_data(holder, (void*) 1);
    lv_obj_clear_flag(holder, LV_OBJ_FLAG_CLICK_FOCUSABLE);
    lv_group_add_obj(g, holder);

    lv_obj_t* cb = lv_checkbox_create(holder);
    lv_checkbox_set_text(cb, "Red");
    lv_obj_align(cb, LV_ALIGN_TOP_LEFT, 10, 10);
    lv_obj_set_user_data(cb, (void*) 2);

    lv_obj_t* cb1 = lv_checkbox_create(holder);
    lv_checkbox_set_text(cb1, "Green");
    lv_obj_align(cb1, LV_ALIGN_TOP_LEFT, 10, 30);
    lv_obj_set_user_data(cb1, (void*) 3);
    //lv_group_add_obj(g, cb);

    lv_obj_t* cb2 = lv_checkbox_create(holder);
    lv_checkbox_set_text(cb2, "Blue");
    lv_obj_align(cb2, LV_ALIGN_TOP_LEFT, 10, 50);
    lv_obj_set_user_data(cb2, (void*) 4);
    //lv_group_add_obj(g, cb);

    lv_obj_t* cb3 = lv_checkbox_create(ui_TestDisplay);
    lv_obj_add_state(cb3, LV_STATE_CHECKED);
    lv_checkbox_set_text(cb3, "Yes");
    lv_obj_align_to(cb3, holder, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 10);
    lv_obj_set_user_data(cb3, (void*) 5);
    lv_group_add_obj(g, cb3);
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

1 Like