How to disable a drop-down list?


Is it possible to set the drop-down list to disabled so that it won’t open when clicked?


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

ESP32 with micropython

What do you want to achieve?

I want to set the drop-down list to disabled so that it won’t open when clicked.

What have you tried so far?

set_click to false

Code to reproduce



The work around I can think of is to set the event callback to manually close the drop-down list whenever the ddlist is pressed or clicked. But I was wondering if there’s better solution.

I would also expect set_click to work. Let me try it and get back to you.

Hi @embeddedt , any luck? Thanks.

See this patch:

works like a charm! thanks so much! @embeddedt

The patch has been merged to master, so you should be able to pull the latest version of that branch and it will include the fix.

1 Like

yes, I did and it worked very well. thanks a ton!!

I just noticed that set_click is gone in lvgl 8. How is this achieved in lvgl >= 8 ?

Try this:

lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE);    // enable click
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);  // disable click

That works. Thanks!

Let me please continue this topic a little. I spent a whole bunch of time to find the answer.

As to version LVGL 7.11.0 (and 7.9.1 and maybe earlier) next link is the only way I could find the solution:
set state LV_STATE_DISABLED by lv_obj_add_state () and clear it by lv_obj_clear_state ()

Hope this can help to someone.