How to remove/know the size/index a buttons were added to the list of list widget on LVGL 8.1

Description

On LVGL V7.11 used APIs about lv_list_remove(list, btn_index), lv_list_get_btn_index(list, btn), lv_list_get_size(list) and etc. but on the LVGL V8.1 these APIs are not available.

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

TI, Embedded linux and eclipse

What LVGL version are you using?

8.1

What do you want to achieve?

I would like to get index of the list widget were added and remove the selected item of the list and get the current size of the list object.

What have you tried so far?

I find the solution to fix this problem when there are no some APIs of the list of V7.11.

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*/

Screenshot and/or video

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

In v8 a lot of logic was added to the core, so widgets like the list are mostly just convenience wrappers. You can just use generic object methods like lv_obj_get_child(list, i) to get a button or label by index.

Hi,

Thank you for your recommend I will try to use generic object methods.

Hello, can you use lv_obj_get_child(list, i) to get the child obj in the list?

Yes, you can see example below,
lv_obj_t* parent = lv_obj_get_parent(obj);

for(i=0; i < lv_obj_get_child_cnt(parent); i++)
{
lv_obj_t* child = lv_obj_get_child(parent, i);

 if(child == current Button)
 {
    Xxxx
 }
 else
{
    Xxxx
 }

}