Nope I need a switch, the problem is if the device have the “on” state, it’s firstly displayed on “off” state, and just after in “on” state, and it causes visual problems.
Was same for the slider but solved with the LV_ANIM_OFF (fistly displayed on 0 position, then on real position)
If you mean on screen load , here you require other way to init based on events LOAD_START … next variant is place hidden switch and unhide after right setup , but your steps is still wrong way.
The switch will be displayed on “off” and a ms after on position “on”.
Ma question is simple. How to display a switch direclty on “on” position ? and from the switch code, it’s not possible
You realy think the solution is hiding the switch, and display it later, or play with even (or use images button) ?
Just need a LV_ANIM_OFF to have slider working, I need 30 lines of code for switch ?
Are you sure it’s my steps that are in wrong way ?
Ok normal work with any GUI is prepare screen and load it only after all widgets is right setup. If your code preffer create on the fly = memory risk = you can do change in lvgl sources as your design need. Is open source…
Do you call these functions before or after loading your screen? Calling them beforehand should make the initial state to be switched off when the widgets get shown.
Set the state of the switch and all other objects first, then call lv_screen_load() afterwards.
@Smanar,
The lv_screen_load function does not belong to version 8.2.0. If you want to load a screen, you should use lv_disp_load_scr. You can check the API for version 8. Map