Nextion Display Question

Hi , I am just starting with Nextion and following a tutorial I have a screen with 2 buttons and a text box

When I press the on button the text window says on and the off button changes the text to off.
They also turn an LED on the Arduino off and on , so far so good

I wanted to have the screen swap between two background pictures pic0 and pic 1 depending on if I had pressed off or on button

by putting this in the arduino code at the place where it acted on the buttons I achieved my aims ,
the screen swapped between pic 0 and pic 1

Serial.print("p0.pic=0");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

or

Serial.print("p0.pic=1");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

The problem is , when it changes the screen it over writes the buttons so you cant see where to press to swap back

How do I make the buttons stay on top and visible or is there a way to make holes in the pics for the buttons to show through . I assume its something to do with crop but I cant understand how to do it

Can any one help please

BTW I am a total Nextion noob so dont be suprised if I ask a lot more questions in the next weeks

Stay Safe

Don

Hi Don,

After 57 posts I would have thought you'd know how to post code in code tags....

I have never tried to change the whole background image so I don't know how it behaves. Cropped images show through a part of one background through another.

My guess is that by changing the whole image you are putting it on top of the buttons and hiding them. You could try vis, see the Nextion instruction set, to bring the buttons to the front after you change the image.

Alternatively, try experimenting with cropped images and see if that does what you need.