How to remove button from List, and How to add button to List


I would like to know how to remove button(and event handler) from List.
and add new button(and event handler) to List.
can someone help.

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


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

//remove all button from List
//add new button to List and set style to button
for (i=0;i<count; i++ ){
lv_obj_t * guider_ui.items[i] = lv_list_add_btn(guider_ui.file_List, LV_SYMBOL_***, &item_name[i][0]);
lv_obj_add_style(guider_ui.items[i], &style_List_btns, LV_PART_MAIN | LV_STATE_DEFAULT);
//add event handler to button
for ( i=0; i<count: i++ ) {
lv_obj_add_event_cb(guider_ui.items[i], file_List_event_handler, LV_EVENT_ALL, ****);

repeating the above code several time, then a hard error occurs.

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.

After review, the program has been changed as follows.


add A label (L_Update) that includes clickable flag to screen.

when this label is pressed, update List items.(next flow)

  1. clear List items. [ lv_obj_clean(guider_ui.list_1); ]

  2. add items to List. [guider_ui.items[i] =lv_list_add_btn(guider_ui.list_1, LV_SYMBOL_**, &f_names[i][0]);]

  3. add event to items. [ v_obj_add_event_cb(guider_ui.items[i], **_handler, **, ** ):]

add event send function for changing List items. [ lv_event_send(guider_ui.L_Update, LV_EVENT_PRESSES, &***): ]


when I want to change List items from Tasks other than lv_task_handler, I call the function( lv_event_send() ).

it seems to be working properly.

( From other Tasks, directly updating the list items causes hang-ups.
but event send function call do not cause hang ups.)

However, I want to change the screen or items in the screen from other tasks.
How can I do this?