eez-open / studio

Cross-platform low-code GUI and automation
https://www.envox.eu/studio/studio-introduction/
GNU General Public License v3.0
601 stars 99 forks source link

Add flag variable and state variable support for [create_screen_...] functions #645

Open FourLeafTec opened 10 hours ago

FourLeafTec commented 10 hours ago

If the variable is only used in the tick function, screen switching may cause state flickering. Initially, the widget state is the default lvgl state, and it won't switch to the variable-specified state until the next tick, resulting in flickering.

Therefore, it's necessary to get the variable value and set the state once during screen creation.

As shown in the image below.

截屏2024-11-22 16 25 46
mvladic commented 9 hours ago

Your code doesn't work in all cases. It works only if expression for Hidden flag or Disabled state is simple expression where only native variable is used. But expression can be anything, at least if you are using EEZ Flow.

Alternative way to prevent flickering is to call ui_tick() not only in a loop after lv_timer_handler or lv_task_handler, but also immediately after calling ui_init()