Changing Screen images and button images at runtime

I trying to replace a control screen for my model railway with an Elecrow 7" display in an Arduino environment.

I have all screens laid out with image buttons and screen images.
I have exported the c and header files.

I would like to know if I add 5 800x480 images to a screen, how I can switch between them at runtime without affecting the buttons and how that can be done.
If I were able to find how the coordinates are pass from SquareLine to the Arduino project without having other files deleted I might be able to work it myself.

Regards
Wolf

You could create one image widget and change the image with lv_image_set_src() Image (lv_image) - LVGL 9.4 documentation

You could create 5 image widgets, and show/hide them using LV_OBJ_FLAG_HIDDEN flag

Probably other ways too.

Hi, Richard’s solution is a good one. However, you can achieve the same result directly in SquareLine Studio by adding “Modify Flag” events to your buttons, which will toggle the “Hidden” flag on the images.

1 Like

Thanks for the suggestions.

It seems however that I have beaten the gun. At his point of time, I can’t even get the basic images to load off the SD card.
Turning the logging on in LVGL I get hundreds of line of warning, that image can’t be loaded at a line in the lvgl code that is the brace at the end of a for statement.
There is no hint as to why.

The file system (FD) is mounted because it does report some stats.
What is wrong after that, I have not been able to work out.
I have reduced the UI to a single screen with a single image for now and hope that I might find an example somewhere that is similar so I can compare it with my sketch and find out what I have missed in setting up the file system and display image decoder, (PNG) and get it working.
The images were converted using the LVGL online converter.

After that, I need to work out how to change screens by finger swipe rather than button press. That will remove 26 widget image buttons.

Have you managed to find a solution to your issue yet?