How do I add other buttons to the list, such as checkbox?

Description

How do I add other buttons to the list, such as checkbox? If there is a good way, please tell me, thank you in advance

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

What LVGL version are you using?

7.4

What do you want to achieve?

I want to add checkboxes or other buttons to the list

What have you tried so far?

I tried adding a CheckBox to the List and a CheckBox to the list button, but none of them worked, as the image shows, I don’t see the checkbox I added to the list.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

void ui_video_dir_list_add_btn(lv_obj_t* list, int num)
{
char file_text[64] = {’\0’};

for(int i = 0; i < num; i++)
{
    sprintf(file_text, "%s    %.2f MB", Video_Dir[i].fileName, Video_Dir[i].fileSize);
    lv_obj_t* btn = ui_list_add_btn(list, IMG_FILE_MP4, file_text);
    lv_obj_set_event_cb(btn, pb_VideoDir_event_cb);
    lv_obj_set_user_data(btn, &Video_Dir[i].fileId);

    lv_obj_t* checkbox = lv_checkbox_create(btn, NULL);
    lv_obj_set_size(checkbox, 40, 40);
    lv_obj_align(checkbox, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0);

    if(i == lastOpenedVideoId)
    {
        lv_list_focus_btn(list, btn);
    }
}

}

Screenshot and/or video

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

Hi,

It’s easier to create your custom list instead. Just create a lv_btns as list item and add checkboxes to them.

@BALA are you able to play mp4 file by LVGL? I am trying to play a small .mp4 on NXP MIMXRT1170-EVK platform with LVGL 8.2, but I can’t find any API to play, so would you please share your expierenc?

Thanks & Best Regards
Sui