Description
I know lv_obj_clean
deletes an object’s children. But does it happen immediately, like lv_obj_del
, or defer for a while like lv_obj_del_async
?
For example, if I have a screen with a button in it. Is it legal to use lv_obj_clean
in this button’s click callback to clear the screen?
What MCU/Processor/Board and compiler are you using?
ESP32, esp-idf. it doesn’t matter.
What LVGL version are you using?
8.2.0
What do you want to achieve?
I hope it’s legal to do that.
What have you tried so far?
I’ve actually done that and it seems to work fine. But I’m still a little worried.
Code to reproduce
lv_obj_t* screen;
lv_obj_t* button;
void callback(lv_event_t* e) {
lv_obj_clean(screen);
}
void example() {
screen = lv_obj_create(NULL);
button = lv_btn_create(screen);
lv_obj_add_event_cb(button, callback, LV_EVENT_CLICKED, NULL);
}