Changing selected button of a list programmatically

Description

I have list that was populated dynamically that reflects a list on another device. At some point the selected button changes and I need to reflect the change in my list.

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

ESP32-SPI TFT/Arduino 1.8.13

What LVGL version are you using?

v7

What do you want to achieve?

To change the selected button of a list programmatically

What have you tried so far?

My idea was to iterate the list and make the change. Is this correct or it could be easier to create the list from scratch?

Code to reproduce

It would be more efficient CPU-wise to iterate the list.

Do you know any example on how to iterate the list object?

Something like this ?

lv_obj_t * child = lv_obj_get_child(parent, NULL);
while(child) {
    /*Do something with "child" */
    child = lv_obj_get_child(parent, child);
}

It would be very similar to that, but you probably want to use lv_list_get_next_btn.