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
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>