Component related info needed

I have to use Labels at different locations on multiple screens. And they all are going to hold the same text.
For that I created a component and made the duplicate Labels as needed. Now, I want to update the text of all labels belong to particular component at once through code.

Please help to achieve that.

Keshav Aggarwal

  • SquareLine Studio version: 1.3.1

For this your require only one label and move it between screens on load.
Ofcourse in code, Squareline dont support load screen management, only setup event for this.
Use more or components is waste resources.

Well, I’m able to change their text values at once from SLS but don’t know how to do it from the code.
@kisvegabor can you help on this?

From code the only option is call lv_label_set_text on all instances. :frowning:

For change you need use get child

lv_label_set_text(ui_comp_get_child(labelcomp, UI_COMP_PANELMENU1_LABEL5),"Service mode BR");

That’s strange.
So, I’m stuck with similar problem.
I want to display notification bar on top of all the screens and have to globally update multiple widgets corresponding to notification bar at once.
It won’t be good approach to manually update notification bars on all screens.

What approach do you suggest?

As i write before, create only one bar and on every screen change parent of bar in onload func. Simple explain create bar on screen1 and all other leave black place for this bar. On screen switching is ONE bar moved to new showe screen.

1 Like

Thanks for replying!
It’s working. Now I’ll have to change the parent of the panel and load the screen manually. Earlier I was changing screens directly via SLS.
Hoping SLS team to get this feature added.

Keshav Aggarwal

SLS have this event type … create event on screen call user func …

Already doing the same way.
Calling this from an Event-

lv_obj_set_parent(ui_Panel_notification ,screen);

I say about this

and only

lv_obj_set_parent(ui_Panel_notification ,screen);

Oh. Great!
I didn’t know about this. Thanks.