We have ui_comp_get_child(), I’d like something like ui_comp_set_child().
Do you see alternative options and workaround to achieve it?
I don’t. I tried using lb_obj_t ** children = lv_obj_get_user_data(comp), but the children are not attached to the component instance, rather they are attached to the LV_EVENT_GET_COMP_CHILD’s user-data. In either case this is approaching the problem at the wrong layer.
Mention some use cases
For UI popups, we have a complex component that can be configured different ways to produce what we want. I need to add a child widget(QR code) that is not available in SquareLine studio. I’d like to create a placeholder child widget that I can swap out with a QR widget when the component is configured at runtime.
Alas, I cannot here. lv_obj_set_parent() will only update the new child’s parent to the component, but will leave the component’s child I’d like to replace.
I would put a widget (e.g. an image) in place of the QR code in the SLS project, give it a Custom Variable Alias, and then using this, I would replace it with the QR code before display at runtime. In the SLS export code, in “your component name”.c, you can look up the original widget code.