EDIT: Ignore the fix below, it leads to unexpected behavior. A better option for this question has been posted here: Lv_roller strange behavior when clearing/adding CLICKABLE flag - #10 by kisvegabor
Hello again,
after trying some more options I eventually decided to just disable all inputs “manually” by recursively looping through the background’s (screen obj) children and disabling the CLICKABLE flag for each child. It turns out that this is the only flag that needs to be disabled, disabling and re-enabling other flags afterwards lead to unexpected results.
Here are the functions used for those interested:
void custom_set_children_input(lv_obj_t* parent, bool enable)
{
uint32_t childCnt = lv_obj_get_child_cnt(parent);
for (int32_t i = 0; i < (int32_t)childCnt; i++)
{
lv_obj_t* child = lv_obj_get_child(parent, i);
custom_set_input(child, enable);
custom_set_children_input(child, enable);
}
}
void custom_set_input(lv_obj_t* obj, bool enable)
{
void (*setInputFunc)(lv_obj_t*, lv_obj_flag_t) = &lv_obj_add_flag;
if (!enable)
{
setInputFunc = &lv_obj_clear_flag;
}
setInputFunc(obj, LV_OBJ_FLAG_CLICKABLE);
}
After disabling all inputs I add the messagebox as a child of the background: all inputs here will still be enabled normally because it is added after disabling the other children’s input.
Hope this post helps others also trying to do the same thing! I mainly wanted to avoid the semi-transparent background because redrawing the whole screen takes too much time.