Accessing component widgets

I’m having an issue with images that are in a component. The images are to show wifi signal strength with an image for various signal strength values. The idea being all images are hidden except one to show the current value. The problem I’m having is if any image is not hidden I can’t access the widget object. For example:

I get the component children objects with:
lv_obj_t * signal0 = lv_obj_get_child(ui_battSignal, UI_COMP_BATTSIGNAL_SIGNAL1);
lv_obj_t * signal1 = lv_obj_get_child(ui_battSignal, UI_COMP_BATTSIGNAL_SIGNAL2);
lv_obj_t * signal2 = lv_obj_get_child(ui_battSignal, UI_COMP_BATTSIGNAL_SIGNAL3);
lv_obj_t * signal3 = lv_obj_get_child(ui_battSignal, UI_COMP_BATTSIGNAL_SIGNAL4);
lv_obj_t * signal4 = lv_obj_get_child(ui_battSignal, UI_COMP_BATTSIGNAL_SIGNAL5);

If anyone of those objects have the hidden flag cleared (it’s visible) in SLS. This if statement is true:
if (!cui_signal1 || !cui_signal2 || !cui_signal3 || !cui_signal4 || !cui_signal5) {
Serial.println(“Error: Signal objects not initialized”);

I figure I’m not accessing these image objects properly and hoping someone might have an idea of what I’m doing wrong.

change to real obj add mised 1

lv_obj_t * signal0 = lv_obj_get_child(ui_battSignal1, UI_COMP_BATTSIGNAL_SIGNAL1);

thank you for your reply!

The image I showed was just the second instance of the component on another screen. I get the same behavior with both battSignal and battSignal1. And to reiterate the child object is set correctly as long as it’s hidden flag is set. If it’s visible, it does show on the display but I can’t hide it and when trying to set the child object it is null.

I should also note that if all the images are set to be hidden in SLS, the if statement returns false and I can manipulate the objects. However adding and clearing the hidden flag doesn’t do anything.

It seems you’re modifying the exported component code, cui_signal1 are only accessible inside the component-creator function and shouldn’t be accessed directly/internally, exported component code normally shouldn’t be modified.
At least you should set the ‘hidden flag’ externally, not inside exported component code, but on ‘signal0…signal4’, I hope you do it like that.
It’s worth to keep an eye on the values of the child-indexes, they start from 0 not 1 with simple lv_obj_get_child which you seem to use. I think you should use ui_comp_get_child instead to get the children. With that the UI_COMP_xx index-values will be correctly aligned.