Remove the default option of the drop down list


I created a drop down list, and I add some optios to it. But I don’t know how to delete default options,such as option 1,option 2 and option 3.

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

NXP RT1052

What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

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

lv_obj_t * ddlist = lv_dropdown_create(lv_scr_act(), NULL);
lv_obj_set_size(ddlist, 200, 60);
lv_dropdown_add_option(ddlist, “OUT OF THIS WORLD”, LV_DROPDOWN_POS_LAST);
lv_dropdown_set_max_height(ddlist, 300);
lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
lv_obj_set_event_cb(ddlist, event_handler);

Screenshot and/or video

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

Try this instead of lv_dropdown_add_option:

lv_dropdown_set_options(ddlist, "OUT OF THIS WORLD");

It will clear the default list and only add back the option(s) you specify.

If you looking for something like: lv_dropdown_del_options(ddlist, “Option1”);
It does not exist !
I don’t think there is a way to delete specific row in either dropdowns, or tables.
You just re-send all the options, and exclude the ones you want to delete.
Use lv_dropdown_clear_options(dd); to clear options.
Although lvgl is great library, to me, this is weakness as this feature is fundamental.

Yeah, I agree with you.

Ok, thanks a lot.

Missing features are better discussed in the Feature Request category where other developers can see and hopefully implement the feature.

Ok, thanks.