Multiple screens / Unique object names

What do you want to achieve?

Create a UI with multiple screens

What have you tried so far?

Designed a multi-screen UI and generated the corresponding code

Screenshot or video


  • SquareLine Studio version: 1.1.0
  • Operating system: Win10
  • Target hardware: PC

Hi everyone!

I’m currently testing SLS 1.1.0 designing a UI with multiple screens. Generating the code I noticed that all the screens are initialized in function ui_init(). Wouldn’t it be more efficient (memory-wise) to initialize the screens before loading them? Or is this a choice to have faster loading screens?

Could it be convenient to decide which of the two solutions adopt when generating the code? Sometimes a fast MCU is used, so responsiveness is not an issue, while memory could be. And in other cases an MCU with a lot of memory can be used, so that allocating all the objects at once might not be an issue.

Also, being all the object declarations global, names across different screens have to be assigned unique: how about generating object names taking into consideration for example the screen name?


We have decided to keep all screens alive continuously to avoid referring to non-existing objects.

Imagine that you have a 2 screens: The first with a button which can hide a slider on the second screen. When the first screen is initialized the button’s event refers to the slider on the second screen. We can prevent it from crashing by NULL checking when screen 2 is not initialized but what if you press the button once to hide the slider and only after that create the second screen. How will you know whether to hide or show the slider?

So it’s assuming all widgets exists at all times is just way simpler.

Regarding the naming we were also thinking about a more clever auto-naming philosophy. My idea is to construct the names like
<screen_name> + <widget_type> + <index>

For example: settings_button_3, about_label_7.

What do you think?

Hi Gabor.

Surely a simpler and safer solution, but in an application with many screens this solution will possibly use a lot of memory. But it’s of course up to developer of SLS :slightly_smiling_face:

Regarding the naming, maybe <screen_name> + <widget_name> could be working. It will still keep the name given by the developer, but unique in the UI. Easy to identify where to find it. How about this?

Here the question is what should be the default value of <widget_name>. <widget_type> + <index>? :slight_smile:

Sure! <widget_name> . <widget_type> + <index> as default value would definitely make sense!

Great! We will see if we can add it to v1.1.1.